Salve a tutti,
sto seguendo questo tutorial in php (http://www.phpsimple.net/mysql_update_record.html) ma non riesco ad aggiornare i dati nel db tramite form.
Questo è il codice della pagina update.php.
Grazie mille.Codice PHP:
<?php
include 'config.php';
include 'opendb.php';
if(@$_POST['Submit']){
$id=$_POST['id'];
$name=$_POST['name'];
$email=$_POST['email'];
$tel=$_POST['tel'];
mysql_query ("UPDATE phonebook set name='$name', email='$email', tel='$tel' WHERE id='$id'");
header("location:select.php");
exit; }
$id=$_GET['id'];
$result=mysql_query("SELECT * FROM phonebook WHERE id='$id'"); $row=mysql_fetch_assoc ($result);
mysql_close();
?>
<html>
<body>
<form id="form1" name="form1" method="post" action="<?php $PHP_SELF; ?>">
Name : <input name="name" type="text" id="name" value="<?php echo $row['name']; ?>"/>
Email : <input name="email" type="text" id="email" value="<?php echo $row['email']; ?>"/>
Tel : <input name="tel" type="text" id="tel" value="<?php echo $row['tel']; ?>"/> </p>
<input type="submit" name="Submit" value="Submit" /> </p>
</form>
</body>
</html>