|
Hello there,
I have a database table called "staff" and I am trying to update the table from a form. The problem is that it does not insert the new data into the table. I have allowed all options for the user in the table properties.
Below is what I have in the file:
<html>
<?php
if ($submit)
{
// Variable Declarations.
$db = mysql_connect ("localhost", "root", "") ;
mysql_select_db ("mysql", $db) ;
$sqlquery = "INSERT INTO staff (emp_id, first_name, last_name, email, dept) VALUES ('$emp_id', '$first', '$last', '$email', '$dept')" ;
$results = mysql_query ($sqlquery) ;
echo "Information has been entered.\n" ;
}
else
{
?>
<form method="post" action="input_form.php">
ID Number:: <input type="text" name="emp_id"> <br><br>
First Name: <input type="text" name="first"> <br><br>
Last Name: <input type="text" name="last"> <br><br>
E-Mail: <input type="text" name="email"> <br><br>
Department: <input type="text" name="dept"> <br><br>
<input type="submit" name="submit" value=" Submit"></form>
<?
}
?>
</html>
Can you tell me what is wrong with the piece of code.
Thanx very much.
|