first php project
Posted: Mon Jul 28, 2003 2:08 pm
Hi - This is my first php project and I'm getting these errors and I'm not sure why.
Notice: Undefined variable: submit in C:\Inetpub\wwwroot\php\db.example5.php on line 8
Notice: Undefined variable: submit in C:\Inetpub\wwwroot\php\db.example5.php on line 27
I'm using PHP Version 4.3.2
Thanks.
***************************
<html>
<body>
<?php
if ($submit) { // this is line 8
// process form
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$sql = "INSERT INTO employees (first,last,address,position) VALUES ('$first','$last','$address','$position')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>"> // this is line 27
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">
</form>
<?php
} // end if
?>
</body>
</html>
Notice: Undefined variable: submit in C:\Inetpub\wwwroot\php\db.example5.php on line 8
Notice: Undefined variable: submit in C:\Inetpub\wwwroot\php\db.example5.php on line 27
I'm using PHP Version 4.3.2
Thanks.
***************************
<html>
<body>
<?php
if ($submit) { // this is line 8
// process form
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$sql = "INSERT INTO employees (first,last,address,position) VALUES ('$first','$last','$address','$position')";
$result = mysql_query($sql);
echo "Thank you! Information entered.\n";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>"> // this is line 27
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">
</form>
<?php
} // end if
?>
</body>
</html>