Tutorial City
By: a guest | Feb 13th, 2010 | Syntax:
PHP | Size: 0.93 KB | Hits: 941 | Expires: Never
<?php
include_once('config.php');
if(isset($_POST['submit'])){
$nome = $_POST['nome'];
$email = $_POST['email'];
$id = $_POST['id'];
$sql = ' UPDATE usuario SET nome = ? , email = ? WHERE id = ? ';
try {
$query = $bd->prepare($sql);
$query->execute(Array($nome,$email,$id));
} catch (PDOException $e) {
echo $e->getMessage();
}
}
?>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<title>Update</title>
<meta charset="UTF-8">
</head>
<body>
<h1>Update</h1>
<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<div><label for="nome">Nome</label><input type="text" name="nome" value="eduardo" /></div>
<div><label for="email">Email</label><input type="text" name="email" value="eduardo.matos@tutorial-city.net" /></div>
<input type="hidden" name="id" value="1" />
<input type="submit" value="Atualizar" name="submit" />
</form>
</body>
</html>