469,290 Members | 1,887 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,290 developers. It's quick & easy.

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
http://www.test.com/jan0106.htm

Thanks

Jan 30 '06 #1
1 1053
islanderjo wrote:
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


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://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Jan 30 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by //\\//\\RLe | last post: by
3 posts views Thread by JIMMIE WHITAKER | last post: by
2 posts views Thread by Sudheer Kareem | last post: by
15 posts views Thread by Joshua Kendall | last post: by
1 post views Thread by Michael D. Reed | last post: by
21 posts views Thread by Dan Tallent | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.