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!

HOW TO RE-DIRECT FROM CGI FILE TO HTML FILE 1

Status
Not open for further replies.

desktopfellow

IS-IT--Management
Sep 24, 2006
11
0
0
US
Hi everyone,

Currently i am doing a server side scripting of cgi.

I have an html page whose action on SUBMIT is directed to a .cgi page which re-directs back to another new html page based on the condition.

contents of test.cgi:
--------------------

print "Content-type: text/html\n\n";

print "Hello, world!\n";

Thnx in advance,
Vishnu
#print redirect("
#print "Location: '
The "HELLO WORLD !" static text is printed but the re-direction command both "redirect" and "Location" failed to re-direct the page.
 
Hi

The [tt]Location[/tt] is a HTTP header. So if you send content before it, that will not act as HTTP header anymore.
Code:
print "Content-type: text/html\n";
print "Location: [URL unfurl="true"]http://10.140.5.30:8080/Result/Report.htm\n\n";[/URL]

print "Hello, world!\n";

Feherke.
 
same with the redirect() function of the CGI.pm module. You can't print an HTTP header before trying to use it.
 
I would like to execute some of the perl functions and then redirect to a different html file.

Say in a cgi file: test.cgi

&upload;
&workonreport;
<redirection code should come here>

After executing the functions, the redirection should happen.



Vishnu
 
Hi

If you want to see the Hello message before stepping forward, use the [tt]Refresh[/tt] HTTP header :
Code:
print "Content-type: text/html\n";
print "Refresh: 3;url=http://10.140.5.30:8080/Result/Report.htm\n\n";

print "Hello, world!\n";
Where the 3 is the time to wait in seconds.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top