?
Solved

CGI Header Problem

Posted on 2003-03-31
3
Medium Priority
?
143 Views
Last Modified: 2012-05-04
I have a redirect on one of my scripts which is supposed to take the browser to another page once the script is complete.  

$successurl = 'http://www.domain.com/';
print "Location: $successurl\n\n";

The problem I'm having is that it's simply printing that on screen not redirecting.  I understand that somewhere in the script it sends the header as print "Content-type: text/html\n\n";  but how do I cancel that when it gets to this section.  I don't want it to print to screen but instead redirect to page.  Is there a different header I could put on top of the above two lines?

Thanks for your help.  This has been driving me nuts for two days.

0
Comment
Question by:acdesigns
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 75 total points
ID: 8242261
You can only output one header.  It has to either be a Content-Type or a Location header, not both.
0
 
LVL 20

Expert Comment

by:jmcg
ID: 8242749
Once that double newline is sent, you've ended the HTTP header and can't add any new header lines. You need to arrange your script so you are not attempting to send multiple, conflicting headers.
0
 

Expert Comment

by:BlackFire
ID: 8246336
as said above, as soon as you use print, the data you printed goes directly to the end user. So once you print it, you cant go back and stop it.  Try doing text search for "content-type" if you dont know where it is.  Another method i use, is put all your headers in a variable, and dont print them until you start printing your content.  Make it a sub like:

&AddHeader()  &DelHeader()  &PrintHeader()

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question