Forum Moderators: coopster

Message Too Old, No Replies

Zip Code Redirect

Zip Code Redirect

         

joshuaip

9:44 pm on Sep 11, 2003 (gmt 0)

10+ Year Member



Hi and thanks in advance for your help. I am a php beginner and the farthest I have really gotten is form processing and a simple calculator. I am curious if you could help me with my next project.

I am looking to have a user type in their zip code to be redirected to another page. Thats all I need the form to do but I really dont know how. I can find the list of zip codes but I dont understand if then statements (yet my book is on the way) and could use some help in the interim.

Again thanks in advance.

jatar_k

10:20 pm on Sep 11, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well an if statement will execute if its test statement is true, else it will process the else statement.

So when someone submits the form with their zipcode in it to the form processor script it will compare the zipcode to a master list and process accordingly. Makes sense so far.

I haven't really done ny zip code redirection but it depends on how many options you have available and where you are getting them from. Are you going to store the master list in mysql? You could store each match with the appropriate page and select it.

There are a million ways to build the whole method I would think. Making pagenames match region names so that you can just load the page with a var and use the same var for other things with in the page.

If you plan on building a large chunk of if else statements you also might want to look at switch statements [ca.php.net]