mwhuen
asked on
auto redirect
hi experts,
after a user filled in my form, i always show him the filled information and ask him to click back:
my code:
print <<HEADER;
<html>
<head>
<title>
Question
</title>
</head>
<BODY background=/server.gif bgcolor="#ffffff"
text="#000066" links="#000099" vlink="#000099" alink="#660099">
<br clear=all>
<br><code>
<p>$name, thank you for sharing your opinion with us on the subject $title. <br>
<p>You may go back and see the updated database on the disscusion list by clicking the LIST button</p>
<a href="http://www.eee.hku.hk/~lhui/titles.html">LIST</a>
<br>
</code>
</body>
</html>
HEADER
now I would like to change it to that
after showing his information, it will automatically load to the destination page.
how can i do that?
Thanks,
mwhuen
after a user filled in my form, i always show him the filled information and ask him to click back:
my code:
print <<HEADER;
<html>
<head>
<title>
Question
</title>
</head>
<BODY background=/server.gif bgcolor="#ffffff"
text="#000066" links="#000099" vlink="#000099" alink="#660099">
<br clear=all>
<br><code>
<p>$name, thank you for sharing your opinion with us on the subject $title. <br>
<p>You may go back and see the updated database on the disscusion list by clicking the LIST button</p>
<a href="http://www.eee.hku.hk/~lhui/titles.html">LIST</a>
<br>
</code>
</body>
</html>
HEADER
now I would like to change it to that
after showing his information, it will automatically load to the destination page.
how can i do that?
Thanks,
mwhuen
<head><META HTTP-EQUIV="REFRESH" CONTENT="5" URL="http://www.eee.hku.hk/~lhui/titles.html">
you can do it in one of the foll ways.
you can wait for some time and show a message to the user and then redirect to the other site (comment line 12 and uncomment line 8 and 9)
or you can just directly throw the user to the site
(uncomment line 12 and comment lines 8 and 9)
+1 #!/usr/local/bin/perl
+2
+3 use CGI;
+4
+5 $query=new CGI;
+6
+7 if ($query->param){ ## The form has been submitted by user
+8 #print "Content-type: text/html\n\n";
+9 #print "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"5; URL=\http://www.e
ee.hku.hk/~lhui/titles.htm l\">";
+10
+11 ## OR you do directly throw the user to a seperate URL
+12 print "Location: http://www.eee.hku.hk/~lhui/titles.html\n\n";
+13 exit;
+14 }
+15
+16 print "Content-type: text/html\n\n";
+17 print "<FORM ACTION=\"".$ENV{SCRIPT_NAM E}."\"METH OD=POST>\n ";
+18 print "Enter anything in the text box: <INPUT TYPE=TEXT NAME=text_mess
age VALUE=\"\">\n";
+19 print "<P><INPUT TYPE=SUBMIT VALUE=\"Submit Now!!\">\n";
+20
+21 print "</FORM>\n";
you can wait for some time and show a message to the user and then redirect to the other site (comment line 12 and uncomment line 8 and 9)
or you can just directly throw the user to the site
(uncomment line 12 and comment lines 8 and 9)
+1 #!/usr/local/bin/perl
+2
+3 use CGI;
+4
+5 $query=new CGI;
+6
+7 if ($query->param){ ## The form has been submitted by user
+8 #print "Content-type: text/html\n\n";
+9 #print "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"5; URL=\http://www.e
ee.hku.hk/~lhui/titles.htm
+10
+11 ## OR you do directly throw the user to a seperate URL
+12 print "Location: http://www.eee.hku.hk/~lhui/titles.html\n\n";
+13 exit;
+14 }
+15
+16 print "Content-type: text/html\n\n";
+17 print "<FORM ACTION=\"".$ENV{SCRIPT_NAM
+18 print "Enter anything in the text box: <INPUT TYPE=TEXT NAME=text_mess
age VALUE=\"\">\n";
+19 print "<P><INPUT TYPE=SUBMIT VALUE=\"Submit Now!!\">\n";
+20
+21 print "</FORM>\n";
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
In fact, the code I listed in my question is from my cgi file.
In the cgi program, I want to show
"
<html>
<head>
<title>
Question
</title>
</head>
<BODY background=/server.gif bgcolor="#ffffff"
text="#000066" links="#000099" vlink="#000099" alink="#660099">
<br clear=all>
<br><code>
<p>$name, thank you for sharing your opinion with us on the subject $title. <br>
</code>
</body>
</html>
"
and after the user read this for 5 seconds, the brower will automatically redirect to another page, the LIST.html.
I have tried the ozo's method:
<head><META HTTP-EQUIV="REFRESH" CONTENT="5" URL="http://www.eee.hku.hk/~lhui/titles.html">
but after 5 seconds, it shows:
"I don't understand the Content-type."
I guess my cgi program may restart again, and check Content-type.
Why?
Please help!!!
:)
Thank
try with the URL= within the content attribute...
<META HTTP-EQUIV="REFRESH" CONTENT="5; URL=http://www.eee.hku.hk/~lhui/titles.html">
<META HTTP-EQUIV="REFRESH" CONTENT="5; URL=http://www.eee.hku.hk/~lhui/titles.html">
ASKER
yes, it works now, thank you all guys.
:)
:)