Hi,
Can somebody please help me from going insane here? I'm echoing out my count($error_list) and it's giving me a big fat 0 (as in ZERO).
I would assume that 0 is not greater than 0, yet that block of code runs instead of the ELSE that contains the INSERT. WHY?
Thanks for any help.
PHP Code:$status = "<p>Please fill out the form and click Submit once.</p>\n";
$showform = true;
if($_POST['addbuyer'])
{
$error_list = array();
$fname = $_POST['fname'];
$lname = $_POST['lname'];
if(empty($fname))
{
$error_list[] = 'First Name is required.';
}
if(empty($lname))
{
$error_list[] = 'Last Name is required.';
}
echo count($error_list);
if(count($error_list > 0))
{
$status = "<ul class=\"errormsg\">\n";
foreach($error_list as $error)
{
$status .= "<li>$error</li>\n";
}
$status .= "</ul>";
echo "Hello";
}else
{
$sql = "INSERT INTO buyers SET fname='', lname='' ;
echo $sql;
if(mysql_query($sql))
{
$status = "<p>Buyer has been added. Please click the buton below to close this window.</p>";
$showform = false;
}
}
}




Bookmarks