Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP! - Automatic Page loading

Status
Not open for further replies.

shamrox

Programmer
Sep 27, 2001
81
0
0
US
I need some help with the line of code to use to make an html page I created to open automatically after a form is submitted. I have a cgi script right now, that automatically creates one of those "thank you for submitting" pages, and I tried replacing that html with the html from the page I made. That didn't work. So, is there a line of code that I'd put after the "Print" function, that would point it to a new page, like samplepage.html ???
Hope I haven't been to confusing.

Bill
 
Give us a concise look at what you have.

I suspect it is a simple syntax error or failure to follow the CGI rules. If you are new to Tek-Tips, please use descriptive titles, check the FAQs,
and beware the evil typo.
 
You could use this small program to print the text of the code out. Just replace the location of the file to where your file is located on the server.

#/usr/bin/perl

use CGI ':standard';

$file = "/location/of/file";

print header;

print &quot;<HTML>\n<BODY>\n&quot;;

open (PERLFILE, <$file) or die &quot;Can't open file for reading: $!&quot;;

while (<PERLFILE>)
{
print &quot;$_<br>\n&quot;;
}
close (PERLFILE);
 
You can simply redirect to the thank you page like this:
Code:
print &quot;Location: [URL unfurl="true"]http://www.somewhere.com/path/thank_you.html\n\n&quot;;[/URL]
You can also print the html directly. The important thing to remember there is that you have to print a content type header first:
Code:
print &quot;Content-type: text/html\n\n&quot;;
print <<ENDHTML;
<html>
<head>
...
</html>
ENDHTML
[code]
Make sure ENDHTML is on a line by itself, starts in column 1, and has at least one line, preferably blank, following it. Tracy Dryden
tracy@bydisn.com
[URL unfurl="true"]www.bydisn.com[/URL]

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top