Blank fields detection
Posted: Thu Dec 04, 2008 8:42 am
having some problems with this code:
I can't get this part to work, I have it on another file and it works fine.
Any help?
Thank you
Code: Select all
<?php
$con = mysql_connect("$hostName","$dbName","$dbUserPw");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("$dbName", $con);
{
//This makes sure they did not leave any fields blank
if (!$_POST['firstname'])
die ('No one here by that name!!');
}
$result = mysql_query ("SELECT * FROM Sandbox
WHERE FirstName='$_POST[firstname]'");
while($row = mysql_fetch_array($result))
{
echo $row['FirstName'] . " " . $row['LastName'];
echo "<br />";
}
?>Code: Select all
{
//This makes sure they did not leave any fields blank
if (!$_POST['firstname'])
die ('No one here by that name!!');
}Thank you