Hello. I've recently set up PHP, MySQL, phpMyAdmin and Xitami up on my local machine. As a starter, I decided I that I would set up a guestbook, however, when I enter my information and click the "Sign" button, I get this error: Notice: Undefined variable: submit in c:\Inetpub\create_entry2.php on line 4 on the create_entry.php page. I have no idea what to do - the code looks fine to me, but I'll paste it anyway.
guestbook.php (page 1)
<?
include("dbconnect.php");
echo("
<h2>Hey, sign my guestbook!</h2>
<form method=post action=\"create_entry.php\">
<b>Name:</b>
<input type=text size=40 name=name>
<br>
<b>Location:</b>
<input type=text size=40 name=location>
<br>
<b>Email:</b>
<input type=text size=40 name=email>
<br>
<b>Your Site:</b>
<input type=text size=40 name=url>
<br>
<b>Comments:</b>
<textarea name=comments cols=40 rows=4 wrap=virtual></textarea>
<br>
<input type=submit name=submit value=\"Sign\">
<input type=reset name=reset value=\"Clear\">
</form>
")
?>
create_entry.php (page 2)
<?
include("dbconnect.php");
if ($submit == "Sign"){
$query = "insert into guestbook
(name,location,email,url,comments) values
('$name', '$location,' '$email', '$url', '$comments')";
mysql_query($query) or
die (mysql_error());
echo("
<h2>Thanks!</h2>
<h2><a href=\"view.php\">View my guestbook!</a></h2>
");
}
else{include("guestbook.php");}
?>
The dbconnect.php page simply connects to the database.
Please help me out.