Redirecting a URL?

Using Perl and when I submit it calls the info.pl file where I take the data from the forms and
save it now I want to send them to a URL, Ex: file://http:www.testing.com"
How do you redirect to the location.  I dont want to write out the whole page cause it already exist.  I want to send them there automatically after I process their data.

Any ideas?

Thanks
eric07Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
#I don't think that URL will work, but:
print "Status: 302 Moved\cM\cJLocation: file://http:www.testing.com\cM\cJ\cM\cJ";
0
ozoCommented:
#I don't think that URL will work, but:
print "Status: 302 Moved\cM\cJLocation: file://http:www.testing.com\cM\cJ\cM\cJ";
0
adam923Commented:
#!/usr/local/bin/perl
#process input here
print <<'EOT';
Location: http://www.yahoo.com/

EOT
#end of perl script
0
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

eric07Author Commented:
Look in the bottom it shows how I used both recommendations:

#!/usr/local/bin/perl

use CGI;
$query = new CGI;

open( FILEIO, ">>reg.txt" ) or
      die( "Cannot open reg.txt file" );

$delm = ",";
$qt = "'";
$fname             = $query->param('firstName');
$lname             = $query->param('lastName');
$title            = $query->param('title');
$badge            = $query->param('badge');
$company      = $query->param('company');
$address      = $query->param('address');
$city            = $query->param('city');
$state            = $query->param('state');
$country      = $query->param('country');
$zip            = $query->param('zip');
$email            = $query->param('email');
$phone            = $query->param('phone');
$fax            = $query->param('fax');
$NovEvent      = $query->param('nov_date');
$DecEvent      = $query->param('dec_date');
$cust            = $query->param('cus_sel');
$sales            = $query->param('sales_sel');
$call            = $query->param('call_sel');
$fin            = $query->param('fin_sel');
$buss            = $query->param('buss_sel');
$supp            = $query->param('sup_sel');
$entr            = $query->param('entr_sel');
$hear            = $query->param('hearSem');
$hear_other      = $query->param('hearSem_Other');
$rep            = $query->param('rep_name');

if( !$badge )
{
      $badge = $lname . "," . $fname;
}

$event = "";

if( $NovEvent && $DecEvent)
{
      $event = "Nov" . "," . "Dec";
}
elsif( $NovEvent && !$DecEvent )
{
      $event = "Nov";
}
elsif( $DecEvent && !$NovEvent )
{
      $event = "Dec";
}

#if( $cust && $sales && $call && $fin & $buss && $entr )

if( $cust )
{
      $cust = "Customer Relationship Management = yes";
}
else
{
      $cust = "Customer Relationship Management = no";
}

if( $sales )
{
      $sales = "Sales/Marketing = yes";
}
else
{
      $sales = "Sales/Marketing = no";
}

if( $call )
{
      $call = "Call Center = yes";
}
else
{
      $call = "Call Center = no";
}

if( $fin )
{
      $fin = "Financials = yes";
}
else
{
      $fin = "Financials = no";
}

if( $buss )
{
      $buss = "Business Intelligience = yes";
}
else
{
      $buss = "Business Intelligience = no";
}

if( $supp )
{
      $supp = "Customer Service And Support = yes";
}
else
{
      $supp = "Customer Service And Support = no";
}

if( $entr )
{
      $entr = "Enterprise Resource Planning = yes";
}
else
{
      $entr = "Enterprise Resource Planning = no";
}


if( $hear == 0 )
{
      $hear = "Direct Mail";
}
elsif( $hear == 1 )
{
      $hear = "Telemarketing";
}
elsif( $hear == 2 )
{
      $hear = "Web Site";
}
elsif( $hear == 3 )
{
      $hear = "Other: " . $hear_other;
}


print FILEIO "'", $fname, "'", ",",
             "'", $lname, "'", ",",
             "'", $title, "'", ",",
             "'", $badge, "'", ",",
             "'", $company, "'", ",",
             "'", $address, "'", ",",
             "'", $city, "'", ",",
             "'", $state, "'", ",",
             "'", $country, "'", ",",
             "'", $zip, "'", ",",
             "'", $email, "'", ",",
             "'", $phone, "'", ",",
             "'", $fax, "'", ",",
             "'", $event, "'", ",",
             "'", $cust, "'", ",",
             "'", $sales, "'", ",",
             "'", $call, "'", ",",
             "'", $fin, "'", ",",
             "'", $buss, "'", ",",
             "'", $supp, "'", ",",
             "'", $entr, "'", ",",
             "'", $hear, "'", ",",
             "'", $rep, "'", "\n";

close( FILEIO );

I tried:

print <<'EOT';
Location: http://ea_system/interact/index.html"
EOT

or

print "Status: 302 Moved\cM\cJLocation:
file://http:/ea_system/interact/index.html";

both keep tellimg me that the cgi script misbehaved by not returning a complet set of HTTP headers.

Any idea?

Thanks allot



0
mikemCommented:
# try using

print "Location:http:/ea_system/interact/index.html\n\n";

Note that the two /n/n MUST be included in the line.

Mike
0
adam923Commented:
mikem - that is ridiculous that you posted an answer the same as my comment from TEN HOURS BEFORE YOU!

eric07 - please reject mikem's answer.. your code is fine you just need a blank line after the header so change this (in the first try): take away the quote from after index.html and add a blank line between the Location: line and the EOT line
don't bother with the status 302 method, it might work but i've tested and used the location method before (it's documented in the definiton of cgi)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eric07Author Commented:
I typed in the wrong why that adam923 should which worked once I looked and typed it over.  And using adam923's answer solved my question.

Thanks
0
eric07Author Commented:
It was my fault I typed in in incorrectly, but looking at it again it worked great.

Thanks a lot.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.