Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    84
    Thanks
    10
    Thanked 0 Times in 0 Posts

    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

  • #2
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,547
    Thanks
    57
    Thanked 148 Times in 147 Posts
    PHP Code:
    $user $_POST['nameOfElement'];
    if(empty(
    $user)) 
    would be better

  • Users who have thanked Phil Jackson for this post:

    alcool9999 (08-30-2009)

  • #3
    New Coder
    Join Date
    Aug 2009
    Posts
    84
    Thanks
    10
    Thanked 0 Times in 0 Posts
    thanks worked perfectly.

  • #4
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,547
    Thanks
    57
    Thanked 148 Times in 147 Posts
    no probs. Help is always at hand if you've had a go first.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •