Results 1 to 3 of 3

Thread: Help with simple form

  1. #1
    Join Date
    May 2009

    Post Help with simple form

    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.


  2. #2
    Join Date
    Nov 2002
    Baltimore, Maryland
    You'll need a third page, one for the JavaScript free folks:
    <form action="java-script-free.php" onsubmit="this.action = /^BD1/.test (this.zip.value) ? 'one-page.php' : 'another-page.php'">
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    May 2009

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