smilesmita Posted August 10, 2008 Share Posted August 10, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/119047-if-else-confusion/ Share on other sites More sharing options...
wildteen88 Posted August 10, 2008 Share Posted August 10, 2008 It'll help if you post your current code. Also how are the zip codes (800,801,802 etc) stored, in an array? Quote Link to comment https://forums.phpfreaks.com/topic/119047-if-else-confusion/#findComment-613015 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.