Link to home
Start Free TrialLog in
Avatar of shannon090797
shannon090797

asked on

Form redirect

Is there an easy way to direct a visitor to another page after he has filled out a form and hit submit?

I have a simple 2 line form I want the visitor to fill in and submit, then redirect him to the next page?

Thanks,
Dave
P.S. I don't write cgi or java scripts. (yet)
Avatar of HolySpirit
HolySpirit

shannon,
<form onSubmit = "top.location = 'next.htm' ; window.event.returnValue = false">
      <!-- Something here -->
<input type = submit>
</form>
-- Holy Spirit
The "action" page must get the values, process them and then response.redirect to another page.

xabi
This has got to be more sophisticated than just a "simple" two line form.  If this is some sort of registration or login page, you are going to want to verify/store this information.

Depending on your server environment, this will require some level of scripting.

Scope out your requirements more fully, and perhaps we can provide an acceptable solution.

Tom
ASKER CERTIFIED SOLUTION
Avatar of sysedco
sysedco

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of shannon090797

ASKER

OK.  This is a two line form.
Name
E-mail address
then
Post to the email account on submit.

Then go to next page and continue.

Dave
if this is as simple as you make it seem, then you can have the form submit to the next page itself.  as in:

<form name = 'fooBar' action = 'myNextPage.htm' method = 'post'>
<!--your form fields here-->
</form>

if you actually need to do some processing on the form, you can submit it to either itself or to the next page, and then do a metatag refresh as in:

page1.htm-

<form name = 'fooBar' action = 'myNextPage.htm' method = 'post'>
<!--your form fields here-->
</form>

page2.htm
<html>
<head>
<!--whatever processing you need done-->
<meta http-equiv="refresh" content="4;URL=http://www.myurl.com/theNextPage.htm">
</head>
<body>
Thanks for your submission, you will be redirected to theNextPage.htm in 4 seconds.
</body>
</html>

dunno if that helps, and I may very well have misunderstood the question <g>
Good Luck

HTML page
---------

<form name = 'fooBar' action = '/cgi-bin/pgm.cgi' method = 'post'>
<!--your form fields here-->
</form>


pgm.cgi
-------

#!/usr/bin/perl

## procedure for sending mail
## .....

print "Content-type: text/html\n";
print "Location: http://www.myurl.com/theNextPage.htm\n\n"


Is this what you want...?
sorry,

print "Location: http://www.myurl.com/theNextPage.htm\n\n";

Missed a semicolon.
you can use an an HTTP 307 to redirect an post request.
Look at www.pda-systems.com they have an tutorial that uses this request.