1
Hey, what’s up, guys? So, I have a problem, I made a function that returns data from a certain table field, so to insert it into the text box of a form; but, the returned value of the field appears on top of the text box, not inside the value="" attribute. I’m only using HTML and PHP to build the algorithm and, I intend not to use javascript for now. If someone answers, I thank you very much for your help, because I am not able to solve such a problem.
//////////////// Editar ///////////////////////
function select($id)
{
global $conn;
$stmt = $conn->prepare("SELECT usuario FROM usuarios WHERE id = $id");
$stmt->execute();
$row_user = $stmt->fetch(PDO::FETCH_ASSOC);
echo $row_user['usuario'];
}
///////////////////////////////////////////////
if (isset($_GET['id']) and $_GET['acao'] == 'editar' and $_GET['campo'] == 'usuario')
{
echo ('
<form method=post>
<input type=text name=edit_usr value='.select($_GET['id']).'><br>
<input type=submit name=edit_envia value=Editar>
</form>
');
Ever tried to change the
echo $row_user['usuario'];
forreturn $row_user['usuario'];
?– Sam
No, I’ll try now
– Alan
Eiiita kkkk, it was perfectly mano! Brigadão ae, even :)
– Alan