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.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|