Help with forms.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • islanderjo

    Help with forms.

    I was wondering how I could create a form field where the viewer would
    be redirected to another webpage depending on the input.

    Ex: user types "Jan0106" in the form field

    and would get redirected to


    Thanks

  • Lachlan Hunt

    #2
    Re: Help with forms.

    islanderjo wrote:[color=blue]
    > I was wondering how I could create a form field where the viewer would
    > be redirected to another webpage depending on the input.
    >
    > Ex: user types "Jan0106" in the form field
    >
    > and would get redirected to
    > http://www.test.com/jan0106.htm[/color]

    You generally shouldn't require the user to enter such bizarre date
    formats into a form, you should make it a little more user friendly by
    either providing 3 separate fields for day, month and year (as long as
    you make it clear which field is which) or using something sensible like
    ISO-8601 (e.g. 2006-01-30).

    As for redirecting the user, that's a server side issue that can be
    easily handled by your form processing script (e.g. PHP, ASP, JSP, Perl,
    Python or whatever you like).

    for example:

    Markup: (minimal example only, some markup omitted for brevity)

    <form method="get" action="/article">
    <p>Year (4 digits): <input type="text" name="year">
    <p>Month:
    <select name="month">
    <option>January </option>
    ...
    </select>
    <p>Day (1-2 digits): <input type="text" name="day">
    </form>

    When submitted, the server side script will receive values for the year,
    month and day, which can then be used to construct the correct file
    name, check if one exists for that date and if it does send a 303 See
    Other HTTP response with a location header field to redirect the user.

    Writing the server side script is off-topic for this newsgroup.

    --
    Lachlan Hunt

    http://GetFirefox.com/ Rediscover the Web
    http://GetThunderbird.com/ Reclaim your Inbox

    Comment

    Working...