inserting blank records into database WHY?
| From: | murtaza | Date: | Mon, 26 Aug 2002 12:16:34 +0000 |
| Subject: | inserting blank records into database WHY? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21362@lists.php.net to get a copy of this message | ||
i had created a guestbook in PHP with mySQL database connectivity,
i'm taking values from a form
SIGN.php
--------------
<form action="create_entry.php" method="POST">
Name : <input type="text" name="name" size="40">
Location : <input type="text" name="location" size="40">
.....................................
............
.........
<input type="submit" name="submit" value="Sign">
</form>
create_entry.php
-----------------------
Hello <?php echo $_POST["name"]; ?>
<?php
mysql_connect ("localhost", "root", "chandan") or die ("could not
connect to database");
mysql_select_db ("chandan") or die ("could not select the database");
if ($submit ==$_POST["Sign"] )
{
mysql_query("INSERT INTO guestbook(name,location,email,url,comments) values
('$name','$location','$email','$url','$comments')");
echo "Thank you for singning my guestbook.";
}
else
{
?>
<h5><font face="Verdana"><a href="sign.php">Sign my
GuestBook!!!</a></font></h5>
<?php
}
?>
but this code is inserting blank records into database why ???
pls help
CHADNAN