if ($submit) { 

if (ISSET($submit)) { 

-----Original Message-----
From: Dan Howard [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 12:21 PM
Subject: [PHP-DB] undeclared variable error


I am very new to PHP, and have been working through some tutorials.  I have
been able to post data from mySQL, but when I tried to do a form page to
enter data into the database I get the following error:

PHP Warning: Undefined variable: submit in c:\inetpub\wwwroot\testform.php
on line 4 PHP Warning: Undefined variable: PHP_SELF in
c:\inetpub\wwwroot\testform.php on line 14 

Here is the code:




if ($submit) { 

// process form 

$db = mysql_connect("localhost", "root"); 


$sql = "INSERT INTO employees (first,last,address,position) VALUES

$result = mysql_query($sql); 

echo "Thank you! Information entered.\n"; 

} else{ 

// display form 


<form method="post" action="<?php echo $PHP_SELF?>"> 

First name:<input type="Text" name="first"><br> 

Last name:<input type="Text" name="last"><br> 

Address:<input type="Text" name="address"><br> 

Position:<input type="Text" name="position"><br> 

<input type="Submit" name="submit" value="Enter information"> 



} // end if ?> 



Does anyone have any ideas, or where I need to look more to learn what the
problem is here?  TIA


PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to