[COLOR=red]error[/COLOR]: PHP Notice: Undefined variable: submit in C:\Inetpub\wwwroot\guestbook\create_entry.php on line 11
[COLOR=red]form code[/COLOR]:
<form method='post' action="create_entry.php">
<b>Name: </b><input type="text" name="name" size="40" /><br />
<b>Location: </b><input type="text" name="location" size="40" /><br />
<b>Email: </b><input type="text" name="email" size="40" /><br />
<b>Home Page Url: </b><input type="text" name="url" size="40" /><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="Start Over" />
</form>
[COLOR=black]–the form accepts name,location, email, url and comments[/COLOR]
[COLOR=red]create_entry.php code[/COLOR]:
<?php
include('dbconnect.php'); //database connection
if ($submit=='Sign') //error occurs here
{
$query="insert into guestbook (name,location,email,url,comments) values
('$name','$location','$email','$url','$comments')"; //insert fields into database
mysql_query($query) or die
(mysql_error());
?>
<h2>Thank you!!?</h2>
<h2><a href="view.php">View My Guest Book!!!</a></h2>
<?php
}
else
{
include('sign.php');
}
?>
[COLOR=black]When I fill in the fields on the form and submit[/COLOR]
[COLOR=black]I get the error “Undefined variable: submit”[/COLOR]
[COLOR=black]what should I change?[/COLOR]
I’m using php 5.1.2