Jump to content

if else confusion


smilesmita

Recommended Posts

hi there:

 

i need to incorporate this if else logic in one of my code and am very confused here.

i have been given 3 lists of zipcodes.the first list has a few zip codes ex starting with 370,371......

2nd is the list having zips starting with 800,801,802...blah blah blah

3rd is the list having zip starting with 460,461..blaah blaah.they all contain lot of zipcodes.

 

Now what i have to do is..i have this form.the user fills the zip code .I take this zip code get the substring of first 3 digit of this zipcode by doing this:

$temp=substr($post_data["zip",0,-2)

 

not i have to write a logic where if $temp ==307 || 371 || 372... then

$post_data["campus"] ==17;

else

$post_data["campus"]==17A;

 

same thing if the $temp == 800 || or anything from 2nd list then

campus==30

else

30A

 

the problem i am facing is the moment it goes to first if loops and finds or doesnt find the zip there,it assigns 17 /17A accordingly even if the zip is 800 or 801 or anything it will just execute the first if else loop.So everything is getting assigned wrong.i need to know how i can incorporate this if else loop successfully so that proper campus code is assigned.?

 

-smita

Link to comment
https://forums.phpfreaks.com/topic/119047-if-else-confusion/
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.