HTML guys: How to program a hyperlink form where you enter the subdomain you get redi

I have some very basic knowledge in HTML and a bit of experience in creating HTML sites with editor tools, mainly Microsoft Frontpage. Currently I’m trying to create an online treasure hunt for a friend. The main idea is this:

The friend is given the URL of the website where the hunt starts, say www.schnittessite.com/hunt.htm. On this site, she will find a riddle she has to solve. The correct answer will redirect her to the next site with the next question, and so on. Suppose the solution to the question on www.schnittessite.com/hunt.htm was “Cecil.” Then the next site, with the next question, would be www.schnittessite.com/cecil.htm, and if the solution to the riddle there was “Adams,” the next site should be adams.htm.

So far, so good, I already have a couple of stages ready. But I don’t know how to do an elegant way of redirecting her to the next site - the current way would be to simply have her write www.schnittessite.com/adams.htm into the address line of her browser manually, which is not too neato. I’d prefer to have some sort of form on the bottom of each page where she would simply enter “adams;” the form, when submitted, should then work as a hyperlink redirecting the browser to adams.htm. If she gets the answer wrong (say, “zotti” instead of “adams”), the browser should redirect her to www.schnittessite.com/zotti.htm, which wouldn’t exist so the website not found page displayed would show her that this was not correct. IOW; I need a way to create hyperlinks (in Frontpage or HTML) where you enter a word, click on “submit” and arrive at the file [word you entered].htm on the same web.

I guess this should be feasible, but I have no clue how.

Hmmm, it’s been a while, but I’m thinking you’re going to need to use Javascript to take the info from the submitted form and then redirect the browser appropriately.

Javascript to redirect:

window.location = “http://www.whatever.com/

So you’d have to read the value of the text box when the “submit” button is pushed and redirect.

Let’s do a simple form:

<FORM NAME=“riddle_form”>
Eneter Answer:
<BR>
<INPUT TYPE=“text” NAME=“answer”>
<INPUT TYPE=“button” VALUE=“Redirect” NAME=“Redirect”
onclick=“RedirectFuntion()”>
</FORM>

At the top of the page your script shoudl look something like this:

<script language=“JavaScript”>

<!–
RedirectFunction()
{
var sDomain = “http://whatever.com/”;
sDomain = sDomain + riddle_form.answer.value + “.html”;
window.location = “http://www.geocities.com/papandrew”;
}

// →
There’s probably a more elegant solution, and there might be an error or two in there somewhere, give a try though, it’s the best I coudl come up with in 2 minutes :slight_smile:

Change the approach.

Provide the user with a finite set of possible answers per question using the radio button on a web form. The user merely selects what they believe is the correct answer by selecting the radio button, and then presses the submit button.

However, the correct approach for a web form requires an underlying script to run the form. This is where FP fails its users. Unless you are posting to an FP-enabled web server where FP extensions are already installed you are almost SOL.

However, as mentioned previously, you can use JavaScript to effect the redirect.

Wouldn’t the contestant be able to “cheat” by viewing the page source?

Not really. All the source code shows is that the page redirected to is essentially: “http://whatever.com/” the answer “.html”.

That won’t help in finding the answer.

Thanks to everybody here! After hours (literally) of trial, error and checking a PHP for beginners guide I found a way to do this using PHP. Thank God my ISP supports that.
Interesting ideas coming up here. Gracias!