www.webdeveloper.com
Results 1 to 3 of 3

Thread: Help with simple form

Hybrid View

  1. #1
    Join Date
    May 2009
    Posts
    2

    Post Help with simple form

    Hi
    Basically I have a site and I want to enable visiters to view a page based on thier post code. What I want is a simple form text box and submit button, if the begining of thier postcode matches I would like them redirected to a specific page and if it doesn't match redirected to another.

    For example

    A user types BD1 in to the text box and clicks submit and is redirected to http://domain.com/hiddenpage.html

    A user types BD2 in the text box and clicks submit and is redirected to http://domain.com/notallowed.html

    I'm sure this is a basic script but I cannot find an example on the internet so if someone could post an example I would appreciate it.

    Thanks.

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,277
    You'll need a third page, one for the JavaScript free folks:
    Code:
    <form action="java-script-free.php" onsubmit="this.action = /^BD1/.test (this.zip.value) ? 'one-page.php' : 'another-page.php'">

  3. #3
    Join Date
    May 2009
    Posts
    2
    Thankyou

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles