Jump to content

Help with PHP issue...


JSHINER

Recommended Posts

Hello,

Right now I have a form, and you enter your zip code. Then:


if(file_exists("/$zip.php"))
{
    include("/$zip.php");
}
else {echo ' Text ';}


However, some towns have multiple zip codes. For example. Town X could have zip codes 00000, 00001, 00002. BUT, there is only ONE zip.php page for each town. So the town's page would be 00000.php.

How do I make it so if you type 00001 or 00002, etc. for your zip, it includes 00000.php.

Thank you,

James
Link to comment
https://forums.phpfreaks.com/topic/25605-help-with-php-issue/
Share on other sites

Hi Ken,

I appreciate your response. I understand you are not here to write code, nor would I expect you to (for free that is).

I first thought about duplicating the 00000.php page so 000001.php would exist, but that brought up the problem that below that include were links to "site.com/$zip/link.php. So that's out of the question.

I also tried if($zip=="00001" || $zip=="00002")... and was going to have that redirect to filename.php?action=search&zip=00000. But that did not work either.

If you could point me in the right direction as to how I can accomplish this, I would greatly appreciate it.
Link to comment
https://forums.phpfreaks.com/topic/25605-help-with-php-issue/#findComment-116935
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.