New Problem
| From: | Eugene Wolff | Date: | Mon, 06 Jan 2003 14:02:44 +0000 |
| Subject: | New Problem | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-9571@lists.php.net to get a copy of this message | ||
Hi,
I have the following script. When I open it says:
Notice: Undefined variable: submit in c:\inetpub\wwwroot\phpTest9.php on
line 4
Although the input boxes all show fine. Obviously it does not do the
first part of the code because ($submit) is not equal to true.
<html>
<body>
<?php
if ($submit){
//Process form
$db = mysql_connect("eugene","root");
mysql_select_db("mydetailsonline",$db);
$sql="insert into employees
(first_name,last_name,cell_phone,home_phone) values
('$first_name','$last_name','$address','$position')";
$result=mysql_query($sql);
echo "Thank you! information entered.\n";
}else{
//display form
?>
<form method="post" action="<?php echo
$_SERVER['PHP_SELF']?>">
First name:<input type="Text" name="first_name"><br>
Last name:<input type="Text" name="last_name"><br>
CellPhone:<input type="Text" name="Cell_phone"><br>
Home phone:<input type="Text" name="home_phone"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
} //end if
?>
</body>
</html>
Thanks again
Eugene