0
index php.
<table border="0" width="100%">
<a href="insere.php">Adicionar</a>
<tr>
<th>Nome:</th>
<th>E-mail:</th>
<th>Açoes:</th>
</tr>
<?php
$sql = "SELECT * FROM usuarios";
$sql = $pdo->query($sql);
if ($sql->rowCount()>0) {
foreach ($sql->fetchALL() as $usuario) {
echo '<tr>';
echo '<td>'.$usuario['nome'].'</td>';
echo '<td>'.$usuario['email'].'</td>';
echo '<td><a href="editar.php?id='.$usuario['id'].'">Editar</a> -
<a href="excluir.php?id='.$usuario['id'].'">Excluir</a></td>';
echo'</tr>';
}
}else{echo "Sem Conexao";}
?>
</table>
edit.php
<?php
require'conecta.php';
$id = 0;
if (isset($GET['id']) && !empty($GET['id'])){
$id = addslashes($GET['id']);
$sql = "SELECT * FROM usuarios WHERE id = '$id'";
$sql = $pdo->query($sql);
if ($sql->rowCount()<0) {
$dado = $sql->fetch();
}
}
?>
<form method="POST">
Nome:</br>
<input type="text" name="nome" value="<?php echo $dado['nome']; ?>"></br>
E-mail:</br>
<input type="text" name="email" value="<?php echo $dado['email']; ?>"></br>
Senha</br>
<input type="password" name="senha"></br>
<input type="submit" value="Atualizar">
</form>
that form he wouldn’t have to be giving a Submit to somewhere?
– Julio Henrique
When you hover the mouse on the link comes to show the filled id?
– rray
$_GET
and not$GET
– Isac
When the mouse passes the right filled id but it seems not to be pulling id and variable $given gets undefined
– Bruno.gm
Even changing $GET to $_GET doesn’t change anything
– Bruno.gm