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