...

View Full Version : if statement problem



alcool9999
08-30-2009, 11:47 AM
hi
i have a form that posts a variable to a php page
the php page then needs the check if what has been sent is sufficent.
i need to check if the field has been left blank so i used this.


if ($user == "");
{
header('Location: fillerror.htm');
exit;
}

but it goes to the error page every time even if i fill in the field.

thankyou

Phil Jackson
08-30-2009, 12:12 PM
$user = $_POST['nameOfElement'];
if(empty($user))
would be better

alcool9999
08-30-2009, 12:18 PM
thanks worked perfectly.

Phil Jackson
08-30-2009, 12:20 PM
no probs. Help is always at hand if you've had a go first.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum