Hi, im having trouble updating info to my database via a form.
The form is already pre-populating with data from the database, so i know it is not the form code that is the problem.
Here is my "Update" code compared to my "Add" code.
Can someone check out my update andhelp me figure out why the db is not updating data?
//if employee edited "this is not working????"
elseif (isset($edit_emp)){
if("Submit" == $edit_emp){
$sql="UPDATE Employees WHERE ID=$emp_id(FirstName,Surname,Phone,Cell,Address,City,State,Zip,Country)
values('$emp_firstname','$emp_surname','$emp_phone','$emp_cell','$emp_address','$emp_city','$emp_state','$emp_zip','$emp_country')";
}
if (mysql_query($sql)){
echo("Your Employee has been edited."."<br>"."<a href=\"".$_SERVER['PHP_SELF']."\">"."Go Back to Listing.</a>");
}else{
echo("Error Editing Submitted Employee");
}
}
//if employee is added
elseif (isset($submit_emp)){
if("Submit" == $submit_emp){
$sql="INSERT INTO Employees WHERE ID=$id(FirstName,Surname,Phone,Cell,Address,City,State,Zip,Country)
values('$emp_firstname','$emp_surname','$emp_phone','$emp_cell','$emp_address','$emp_city','$emp_state','$emp_zip','$emp_country')";
}
if (mysql_query($sql)){
echo("Your Employee has been added."."<br>"."<a href=\"".$_SERVER['PHP_SELF']."\">"."Go Back to Listing.</a>");
}else{
echo("Error Adding Submitted Employee");
}
}