-1
Guys, I need some help. I’m doing a PHP job, but I can’t edit it through the form or log in.
edita-usuario.php /
<?php
session_start();
include "conexao.php";
$id = $_GET['idusuario'];
$sql = "SELECT * FROM usuario WHERE id={$id}";
$usuario = $conn->query($sql);
//print_r($cliente->fetch_assoc());
$dados = $usuario->fetch_assoc();
//echo $dados['email'];
$conn->close();
?>
<?php include "include/header.php" ?>
<h1>Edita Cliente</h1>
<form method="get" action="atualizar-usuario.php" >
<input type="hidden" name="id" size="15"
value="<?php echo $dados['id'];?>" />
<label>E-mail</label>
<input type="text" name="email" size="15"
value="<?php echo $dados['email'];?>" />
<br/>
<label>Senha</label>
<input type="text" name="senha" size="15"
value="<?php echo $dados['senha'];?>" />
<br/>
<input type="submit" value="Atualizar" />
</form>
<?php include "include/footer.php" ?>
update-user.php
<?php include "conexao.php"; $id = $_POST['id']; $EmailUsuario = $_POST['email']; $SenhaUsuario = $_POST['senha']; $sql = "UPDATE usuario SET email='{$EmailUsuario}', senha='{$SenhaUsuario}' WHERE id={$id}"; if ($conn->query($sql) === TRUE) { echo "Atualizado com sucesso"; }else { echo "Error: " . $conn->error; } $conn->close(); ?>
update-user.php <? php include "connection.php"; $id = $_POST['id']; $Emailusuario = $_POST['email']; $Senhausuario = $_POST['password']; $sql = "UPDATE usuario SET email='{$Emailusuario}', password='{$Senhausuario}' WHERE id={$id}"; if ($Conn->query($sql) === TRUE) { echo "Updated successfully"; }Else { echo "Error: " . $Conn->error; } $Conn->close(); ?>
– Juan Campos
Put this in your question and not in the comments.
– Maury Developer