PHP邮政编码匹配

How can I have it if a zip is entered that I have a page for go to the page for the zip and if not then go to another page? I'm new to PHP and don't know how to start.

Check out the php manual. The section your looking for is on html forms processing. http://us.php.net/tutorial.forms

The simplest solution is to do the following:

  • Submit the form to a php script
  • From the php script get the Zip code from the form and check to see if you have the page for it (using file_exists maybe)
  • If you have a page then send the Location header to redirect to that page:

    header("Location: /path/to/zip/pages/$ZipPage");

  • If not then redirect to your alternate page (using the method above.

You can achieve the same effect by including the page you want directly but that will prevent the user from bookmarking the page.

If you also need to forward the form onto the next page then that'll probably mean the alternative solution would be better (there are ways around the bookmarking problem though which I can go though if you would like)