Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-30-2009, 11:47 AM   PM User | #1
alcool9999
New Coder

 
Join Date: Aug 2009
Posts: 84
Thanks: 10
Thanked 0 Times in 0 Posts
alcool9999 is an unknown quantity at this point
if statement problem

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
alcool9999 is offline   Reply With Quote
Old 08-30-2009, 12:12 PM   PM User | #2
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
PHP Code:
$user $_POST['nameOfElement'];
if(empty(
$user)) 
would be better
Phil Jackson is offline   Reply With Quote
Users who have thanked Phil Jackson for this post:
alcool9999 (08-30-2009)
Old 08-30-2009, 12:18 PM   PM User | #3
alcool9999
New Coder

 
Join Date: Aug 2009
Posts: 84
Thanks: 10
Thanked 0 Times in 0 Posts
alcool9999 is an unknown quantity at this point
thanks worked perfectly.
alcool9999 is offline   Reply With Quote
Old 08-30-2009, 12:20 PM   PM User | #4
Phil Jackson
Senior Coder

 
Join Date: Aug 2009
Location: Mansfield, Nottinghamshire, UK
Posts: 1,547
Thanks: 57
Thanked 148 Times in 147 Posts
Phil Jackson is on a distinguished road
no probs. Help is always at hand if you've had a go first.
Phil Jackson is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:12 PM.


Advertisement
Log in to turn off these ads.