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.


In reply to problem with redirecting to a cgi page by srinivas_rocks

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.