Log in

View Full Version : goto page textbox form



cau96176
08-30-2010, 09:44 PM
Hi All!!

A bit of a noob here but I was wondering if the following was possible.

I have a simple webpage that is going to say
"to find your page enter your ref no below"

Then I was hoping for a textbox and a go button........and when they click on the button it takes them to a matching page.

Eg, James has the reference AF54 so when he types it in, clicks go he will be redirected to

http://www.mysite.com/AF54.htm

Nothing personal or security required just a wee info page for them.

I hope someone can help :)

jscheuer1
08-31-2010, 12:10 AM
That idea has at least one major flaw. The user may input anything, and there is no guarantee that the page it represents exists. That said:


<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

</head>
<body>
<form action="#" onsubmit="location = this.elements.choice.value + '.htm'; return false;">
<input type="text" name="choice"> <input type="submit" value="Go">
</form>
</body>
</html>

That'll do it.

cau96176
09-11-2010, 04:59 PM
Thank you very much!!!

That did the trick :D