# Error submiting a form

**URL:** <https://forum.kirupa.com/t/error-submiting-a-form/223653>\
**Category:** programming\
**Created:** [April 24, 2007, 5:26pm UTC](https://forum.kirupa.com/t/error-submiting-a-form/223653 "2007-04-24T17:26:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Utech22](https://avatars.discourse-cdn.com/v4/letter/u/f17d59/32.png) [@Utech22](https://forum.kirupa.com/u/Utech22)\
**Post date:** [April 24, 2007, 5:26pm UTC](https://forum.kirupa.com/t/error-submiting-a-form/223653/1 "2007-04-24T17:26:38Z")

</div>

**[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]:

```auto
 
<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
 
<?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
