Jump to content

elseif statement not working


Lostnode

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
https://forums.phpfreaks.com/topic/228359-elseif-statement-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.