If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Oct 2010
    Member #
    How can I create on my site an error message when the user submits an invalid zip code?
    For example, in this site: , if I submit the zip code 99999 I get an error message: Please enter a valid zip code.

    This is the code on my site:

    <form action="http://the next page" method="get" name="form">
    <input type="text" name="zipcode" maxlength="5" id="zipcode" />
    <br />
    <input type="submit" name="search" id="button" value=""/>


  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Not from USA
    Member #
    2783 times
    You'd probably start with something like this and then check the zip code against the database to ensure that you have a valid US zip code (or not).

    Alternatively, a regular expression would work, but not for that particular zip code, as that particular zip code would validate as a 5-digit numeric expression.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
All times are GMT -6. The time now is 05:34 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: