I don't see anywhere in your form the value of 'id'
Place a hidden field in your form to hold this value so the SQL statement will read the value and update.
JeniF
Junior Poster in Training
52 posts since Aug 2007
Reputation Points: 10
Solved Threads: 5
try this:
<?php
include("connectdb.php");
if(isset($_POST['Submit'])){
$id = $_REQUEST['id'];
$name = $_REQUEST['name'];
$email = $_REQUEST['email'];
$tel = $_REQUEST['tel'];
$sql = "UPDATE phonebook SET name = '" . $name . "', email = '" . $email . "', tel = '" . $tel . "' WHERE id = '" . $id . "'";
$query = mysql_query($sql);
if ($query) {
header("location:select.php");
exit;
}
}
$id = $_REQUEST['id'];
$result=mysql_query("select * from phonebook where id='$id'");
$row=mysql_fetch_assoc($result);
?>
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194
it has never given me an error
kkeith29
Nearly a Posting Virtuoso
1,357 posts since Jun 2007
Reputation Points: 235
Solved Threads: 194