Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

How to do a form redirect?

Form redirect

5:36 am on Feb 1, 2006 (gmt 0)

10+ Year Member

I have the following form redirect,

<form method=post onSubmit="window.open ('index.htm')" action="http://us.1.p.webhosting.yahoo.com/forms?login=__">

<input type="submit" value="Submit Comments"></form>

When submitting the form, how do I get it to redirect to my index page without opening up another window? Right now, it is opening a new window and the other window shows all the information entered into the form.

Thanks for helping.

6:58 am on Feb 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

What are you trying to achieve?
The form has to submit to somewhere.

You could remove the
onSubmit="window.open ('index.htm')"
Then it won't open up the second window, however it also won't go to your index page, but rather to the page in the action.

For it to go to your index.htm after submitting, then the target page that you are submitting to has to do the redirect.

5:33 pm on Feb 1, 2006 (gmt 0)

10+ Year Member

I am trying to get the customer to go to a Thank You page when the customer submits the form. Right now, all it does is go to a page listing all the selections picked.
7:20 pm on Feb 1, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

So can you edit the page to which the form is submitting?
3:17 am on Feb 2, 2006 (gmt 0)

10+ Year Member

No, the page I am submitting to does not allow me to make changes. The form works by sending me an email with the information via yahoo.

If there isn't a way around this, can this function be accomplished with javascript?

4:03 am on Feb 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

No, not easily and certainly not with JavaScript. If you could do it with JavaScript then you would have a massive cross domain scripting vunerability.
5:43 pm on Feb 2, 2006 (gmt 0)

10+ Year Member

Then, is there anyway to accomplish what I want without going through the yahoo domain?
7:13 pm on Feb 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Where is your form hosted? If on Yahoo, then possibly no, you are limited to what Yahoo offers as services.
On most other web hosting services you could write a form that would do the e-mailing and have a thank you as well.
7:30 pm on Feb 2, 2006 (gmt 0)

10+ Year Member

Sounds like you need to add a HIDDEN FIELD so it redirects your user to a thank you page you have created. Try this code below your <form>:

<input type="hidden" name="redirect" value="http://your.host/to/file.html">

7:42 pm on Feb 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Or possibly the other one I came accross is this
<input type="hidden" name="next_url" value="URL">
and it was talking about the Geocities/Yahoo mail form.
11:59 pm on Feb 2, 2006 (gmt 0)

10+ Year Member

Thanks for all the help. Is this how I do it? Then, how do I get the submit button to display?

<form method=post action="http://us.1.p.webhosting.yahoo.com/forms?login=__">

<input type="hidden" name="redirect" value="http://your.host/to/file.html">


7:09 pm on Feb 3, 2006 (gmt 0)

10+ Year Member

You would need to add a button like this:

<input type="submit" name="Submit" value="Submit">

That would go above your "</form>" code. Maybe you should think about going through some form tutorials there are plenty of them online or pick up an html book :)

3:45 am on Feb 4, 2006 (gmt 0)

10+ Year Member


Thanks for posting. Actually, what I am struggling is how to implement a form submit with a redirect. I was told that the following will do a redirect, then the question is how do I do this with a submit button.

<input type="hidden" name="redirect" value="http://your.host/to/file.html">


8:13 am on Feb 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Just as jollygoodfella said, the button doesn't differ, you are just adding a hidden field to the form, that the receiving page has to process.
12:22 am on Feb 7, 2006 (gmt 0)

10+ Year Member

The use of hidden fields basically tell the form different things without the user seeing them. So you would still setup your form with its name, action, etc... then add your input fields and a submit button. The HIDDEN fields can go anywhere between "<form" and "</form>". I usually place mine right below the opening "<form>" statement. There are all kinds of hidden fields you can use, some are: redirect, required (which marks certain input fields required), subject, etc...

What kind of information are you trying to collect exactly? If you don't have a working form already I would suggest looking at [scriptarchive.com...] as it goes into pretty good detail about getting a form setup.

I could also lend a hand for a small fee of course if you are having a tough time. But keep reading and playing around with it...that's going to be your best bet in the long run and you'll figure it out:)

6:07 am on Feb 7, 2006 (gmt 0)

10+ Year Member

Thanks for all the help... looks like I can do both a hidden field and submit field in a form. I will try and see if this will work for me.

Basically, what I have right now is a form where I collect some survey information from customers as they sign up as memebers. But I would love to be able to redirect to a thank you page and offer an immediate coupon code when they submit the form. Right now, it only shows the information entered when the form is submitted.

ONce again, thanks!

10:55 pm on Feb 8, 2006 (gmt 0)

10+ Year Member

just add that hidden field, create that thank you page and you should be golden.
4:34 pm on Feb 12, 2006 (gmt 0)

5+ Year Member


<form method=post onSubmit="window.location='index.htm' action="http://us.1.p.webhosting.yahoo.com/forms?login=__">

<input type="submit" name="submit" value="submit">

it works and you dont have to change the page that will recive the form


Featured Threads

Hot Threads This Week

Hot Threads This Month