Problem with php code
Posted: Wed Oct 26, 2005 8:04 am
Jcart | Please use
My code for sign.php
The result I got when running create_entry.php is
Notice: Undefined index: submit in c:\Inetpub\wwwroot\create_entry.php on line 4
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi all , I just started to learn PHP , I encounter an error when trying this code. Can u enlighten me ?
My code for creat_entry.php isCode: Select all
<?php
include("dbconnect.php");
if ($_POST['submit'] == "Sign!")
{
$query = "insert into guestbook
(name,location,email,url,comments) values
(‘$name’, ‘$location’, ‘$email’, ‘$url’, ‘$comments’)";
mysql_query($query) or
die (mysql_error());
?>
<h2>Thanks!!</h2>
<h2><a href="view.php">View My Guest Book!!!</a></h2>
<?php
}
else
{
include("sign.php");
}
?>Code: Select all
<h2>Sign my Guest Book!!!</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>Home Page URL:</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="Start Over">
</form>The result I got when running create_entry.php is
Notice: Undefined index: submit in c:\Inetpub\wwwroot\create_entry.php on line 4
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]