Hi,
I'm doing my first PHP job and would like some help. I'm trying to create a php setup so that when a user enters their zip code in a simple form, it directs them to three different store locations. If the zip code entered is not associated with any of the three locations, it sends the user to a page that says something like "this zip code is not a part of the network etc." There are about 400 zip codes included. I know I should use a DB, but I'm not quite there yet. I was hoping I could do this one with a script instead.
This is what I have so far. It just keeps going to the default 'out-network.php', however. The scottdale.php file is one of the store locations.
Any idea what I'm doing wrong?
Here is the form code to call up the script:
<form name="" method="post" action="redirect.php">
<input name="zip" type="text" id="zip" size="10">
<input type="submit" name="Submit" value="Go">
<br>
</form>
redirect.php is the script file of course. Contains th e following code:
<?php
$url = '';
switch ($zip) {
case "30002":
case "30012":
case "30013":
case "30014":
case "30015":
case "30016":
case "30017":
case "30018":
case "30021":
case "30025":
case "30030":
case "30031":
case "30032":
case "30033":
case "30034":
case "30035":
case "30036":
case "30037":
case "30038":
case "30039":
case "30047":
case "30048":
case "30052":
case "30054":
case "30055":
$url = '/scottdale.php';
break;
default:
$url = '/out_network.php';
break;
}
header("Location:" . $url);
?>
Thanks for the help.