Forum Moderators: coopster & phranque

Message Too Old, No Replies

CGI script sends user to a URL

when script is done executing

         

runner

2:24 am on Feb 5, 2006 (gmt 0)

10+ Year Member



When my CGI script is done running I want it to direct the user to a specific URL. I can't figure out a way to do this cleanly. Right now I have the CGI script generate a very simple web page with a meta tag that redirects the user's browser to the page.

<html><head>
<META http-equiv="refresh" content="0;URL=http://example.com/abcd.html/">
</head></html>

This works but I wanted to know if there was a better way. I read somewhere it was not good to use the refresh tag.

milanmk

2:52 am on Feb 5, 2006 (gmt 0)

10+ Year Member



$redirect = "http://sample.com/thankyou.htm";

print "Location: $redirect\n\n";

cochranrg

10:45 pm on Feb 17, 2006 (gmt 0)

10+ Year Member



print "Location: $redirect\n\n";

I've tried this, but did not work. Just printed the line like I thought it would. Is this supposed to redirect auto-magically to the said page?

milanmk

11:08 pm on Feb 17, 2006 (gmt 0)

10+ Year Member



Remove the following line from your script.

print "Content-Type text/html\n";

cochranrg

11:09 pm on Feb 17, 2006 (gmt 0)

10+ Year Member



BINGO! Works like a charm. Thanks!

Rob