http://www.perlmonks.org?node_id=695252

srinivas_rocks has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

Seek your help on redirecting a page in CGI I have written a simple CGI page which accepts the username and password. From obtained values I pass them to a subroutine which creates cookies and returns to main. In main routine I redirect it to another page. Here is my sample code:

#! /usr/bin/perl use CGI; print $cgi->header(); print $cgi->start_html(-title=>'Login',-script=>$JSCRIPT); print qq{<center><link rel=stylesheet href="/wadmin.css" type="text/cs +s">}; if( $cgi->param('smbt')) { &creat_cooke(); print $cgi->redirect("Welcome.cgi"); } else { print qq{<form name="frm" method="POST">}; print qq{User<input type ="text" name="login" size=14 maxlength=10>}; print qq{Password <input type ="password" name="password" size=14 maxl +ength=10>}; print qq{<input type="submit" name="smbt" value="Submit" onclick="retu +rn verify()">}; }
When the code reaches to redirecting part it is giving me Status: 302 Moved Location: sample.cgi

Did I make any mistake while redirecting or any other part. Is that related to cookies ( as per my knowledge it should not )

Please help me with this.

Thanks in Advance

Srinivas.