Jump to content

elseif statement not working


Recommended Posts

Ok I have a new issue, and for the life of me, I cannot figure out where I went wrong, in my head it looks sound, but it does not seem to really work.  I get no errors, but it does not work.


if ($_REQUEST['postal'] != "" && $_REQUEST['lbs'] == "" && $_REQUEST['length'] != "" && $_REQUEST['width'] != "" && $_REQUEST['height'] != '') {

} elseif ($_REQUEST['postal'] == "" && $_REQUEST['lbs'] != "" && $_REQUEST['length'] != "" && $_REQUEST['width'] != "" && $_REQUEST['height'] != '') {

// THis is the problem right here.... //
} elseif ($_REQUEST['postal'] == "" && $_REQUEST['lbs'] == "" && ($_REQUEST['length'] == "" || $_REQUEST['width'] == "" || $_REQUEST['height'] != '')) {

} elseif ($_REQUEST['postal'] != "" && $_REQUEST['lbs'] != "" && $_REQUEST['length'] != "" && $_REQUEST['width'] != "" && $_REQUEST['height'] != "") {

} else {



The Second elseif is the issue.  If I enter the postal and weight, it should go to that if else and execute its code, because I left all the length, height and width blank.  But in stead it goes to the last else.


What I am looking to do is that if any of the length, width, or height is not entered, then it comes back with an error... But it does not seem to pick up on it.  ANy help would be appreciated.


[EDIT] I swear I looked at it 50 times and didn't see it...  I go and make my post, re-read it and realize my operators were all wrong... [makes action of smaking slef in head] [/EDIT]

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.