I've got an html page with an input form on it.
I submit the info on the form with a call to insert.php in which I request the values with the $_POST like this:
<?PHP
$first = $_POST[first];
$last = $_POST[last];
$city = $_POST[city];
$state = $_POST[state];
$zip = $_POST[zip];
$phone = $_POST[phone];
$db = mysql_connect("Dev-1", "root", ""
;
mysql_select_db("db1", $db);
$sql = "Insert into table1 (First, Last, City, State, zip, Phone)
Values ($first, $last, $city, $state, $zip, $phone)";
$result = mysql_query($sql, $db);
?>
The idea, obviously, is to add a record to a table in the database.
The problem is when I run it, I get these err messages:
Notice: Use of undefined constant first - assumed 'first' in C:\phptest\insert.php on line 15
Notice: Use of undefined constant last - assumed 'last' in C:\phptest\insert.php on line 16
Notice: Use of undefined constant city - assumed 'city' in C:\phptest\insert.php on line 17
Notice: Use of undefined constant state - assumed 'state' in C:\phptest\insert.php on line 18
Notice: Use of undefined constant zip - assumed 'zip' in C:\phptest\insert.php on line 19
Notice: Use of undefined constant phone - assumed 'phone' in C:\phptest\insert.php on line 20
Can anyone tell me what I'm doing wrong?
David
I submit the info on the form with a call to insert.php in which I request the values with the $_POST like this:
<?PHP
$first = $_POST[first];
$last = $_POST[last];
$city = $_POST[city];
$state = $_POST[state];
$zip = $_POST[zip];
$phone = $_POST[phone];
$db = mysql_connect("Dev-1", "root", ""

mysql_select_db("db1", $db);
$sql = "Insert into table1 (First, Last, City, State, zip, Phone)
Values ($first, $last, $city, $state, $zip, $phone)";
$result = mysql_query($sql, $db);
?>
The idea, obviously, is to add a record to a table in the database.
The problem is when I run it, I get these err messages:
Notice: Use of undefined constant first - assumed 'first' in C:\phptest\insert.php on line 15
Notice: Use of undefined constant last - assumed 'last' in C:\phptest\insert.php on line 16
Notice: Use of undefined constant city - assumed 'city' in C:\phptest\insert.php on line 17
Notice: Use of undefined constant state - assumed 'state' in C:\phptest\insert.php on line 18
Notice: Use of undefined constant zip - assumed 'zip' in C:\phptest\insert.php on line 19
Notice: Use of undefined constant phone - assumed 'phone' in C:\phptest\insert.php on line 20
Can anyone tell me what I'm doing wrong?
David