Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
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.