Click to See Complete Forum and Search --> : redirect page with cgi


mc_pandey
08-25-2010, 08:29 AM
Hi ,

In the HTML form below i want to first execute the CGI script (test.cgi) given in the action parameter and then redirect to some other page.How can i do that ?
I tried

print "Location: http://www.sitepoint.com/forum/showthread.php?t=540311\n\n";

in the CGI script but it is just printing this url.


<form action="test.cgi" method="post">
<h1> Pulling Testcases From TIMS </h1>

<table border="1">
<p> Please Enter the Parent Folder ID <p>
<tr>
<td><input type="text" name="testcase" value="" maxlength="100" /></td>
</tr>
</table>

<br>
<input type="submit" value="Submit"/>

</form>

Thanks
Manish

sohguanh
08-27-2010, 03:59 AM
Hi ,
In the HTML form below i want to first execute the CGI script (test.cgi) given in the action parameter and then redirect to some other page.How can i do that ?
I tried

print "Location: http://www.sitepoint.com/forum/showthread.php?t=540311\n\n";

in the CGI script but it is just printing this url.



Above is not enough to cause redirect. I scan wikipedia and below are two ways to achieve it.



print << 'EOF';
<html><head>
<meta http-equiv="Refresh" content="0; url=http://www.sitepoint.com/forum/showthread.php?t=540311" />
</head><body>
<p>Please follow <a href="http://www.sitepoint.com/forum/showthread.php?t=540311">link</a>!</p>
</body></html>
EOF




print "Refresh: 0; url=http://www.sitepoint.com/forum/showthread.php?t=540311\r\n";
print "Content-type: text/html\r\n";
print "\r\n";
print "Please follow <a href=\"http://www.sitepoint.com/forum/showthread.php?t=540311\">link</a>!"

mc_pandey
08-27-2010, 04:32 AM
Actually that is enough !

I just had to print it in the beginning of the CGI script before printing anything else and it is working for me that way.

Anyway thanks for exploring and replying about other ways of doing it:-)

Manish.