Log in

View Full Version : Text form field leads to URL?



Old John
02-23-2009, 01:13 AM
Hi all

I have 26 folders inside a website, labelled 'a' to 'z'.

On the home page of the site I want a text form field, with a submit button.

If someone lands on the site's home page and types in eg j in the text form field, I want them to land on the 'j' folder home page

Does anyone know if a script like that is out there somewhere?

I can't google it because I can't figure out what search term to use

I hope someone can help

Cheers

Old John

traq
02-23-2009, 04:52 AM
<form>
<p>Enter any single letter and click submit.</p>
<input type="text" name="letter" size="1">
<input type="button" value="Submit" name="B1"
onclick="document.location.href = letter.value + '/index.html'">
</form>
make sure each folder has a page called "index.html" (or whatever you want to name each folder's home page).
this also supposes that the a-z folders are all in the same folder as this form.
also, make sure the text input name (here, "letter") is the same in both spots.

Old John
02-23-2009, 07:01 PM
Worked like a dream, Traq!

Thank you very much mate!

Cheers

John