Thread: isset() help
View Single Post
Old Jan 23rd, 2008, 9:23 AM   #1
kishou
Programmer
 
Join Date: May 2007
Posts: 52
Rep Power: 2 kishou is on a distinguished road
isset() help

im just wondering but why won't this isset() function not working? it still inerts the values nito my MySQL database even if the comment box isnt filled out. and thanks!
here's my code:

<?php
if (!isset($_POST['comment'])
{
die("Please out whole form.");
}
else
$con = mysql_connect("localhost","kishou","0973059457");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("aaabatt_mainwebsite", $con);
$name = mysql_real_escape_string($_POST['name']);
$email = mysql_real_escape_string($_POST['email']);
$comment = mysql_real_escape_string($_POST['comment']);
$sql=("INSERT INTO Comments (name, email, comment)
VALUES
('$name','$email','$comment')");
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
mysql_close($con)


?>
<?php
//Redirect Browser
header("Location: http://www.kishouvision.com/tutorials/commentshow.php");
?>
<html>
<head>
<title>
</title>
</head>
<body>
</body>
</html>
kishou is offline   Reply With Quote