I can post the main file to this, but I don’t think it is needed as the ID number displays as being passed. I cannot get the form to display though. I am new at all this.
Update Data <?php //Connect to mysql $dbc=mysql_connect('localhost','jC', '13'); //Select the Database jC mysql_select_db("jC",$dbc);//Define the query
if (isset($_GET[‘ID’]) && is_numeric($_GET[‘ID’])) {
$query=“SELECT * FROM employee WHERE ID={$_GET[‘ID’]}”;
if ($r=mysql_query($query)) {
$row=mysql_fetch_array($r);
//Make the form:
print ’
Last Name:
First Name:
Email:
Phone:
'; } else { print 'Could not retrieve the record because:
'.mysql_error().'.
The query being run was: '.$query.'
'; } } elseif (isset($_POST['ID']) && is_numeric($_POST['ID'])) { $problem = FALSE; if (!empty($_POST['Last_name']) && (!empty($_POST['First_name']) && (!empty($_POST['Email']) && (!empty($_POST['Phone'])) { $Last_name=mysql_real_escape_string(trim($_POST['Last_name'])); $First_name=mysql_real_escape_string(trim($_POST['First_name'])); $Email=mysql_real_escape_string(trim($_POST['Email'])); $Phone=mysql_real_escape_string(trim($_POST['Phone'])); }else { print 'Please submit ALL of the information required.
'; $problem = TRUE; }if (!$problem) {
$query = “UPDATE employee SET Last_name=’$Last_name’, First_name=’$First_name’, Email=’$Email’, Phone=’$Phone’ WHERE ID=($_POST[‘ID’]}”;
$r = mysql_query($query);
if (mysql_affected_rows() == 1) {
print ‘
The record has been updated.
’;} else {
print ‘
Could not delete the record because:
’.mysql_error().’.
The query being run was: ‘.$query.’
’;}
}
} else {
print ‘
This page has been accessed in error.
’;}
mysql_close();
?>
Any help would be appreciated, I have tried everything I know to do. Thank you.