Hi Monks!
All that I am trying to do here is to set these cookies (the cookies part work if) and redirect to another page after the cookies get set, but if I use any of the methods here the cookies will not work. Why?
Can someone give me a hand on that please?
I tried all of them.
Here is the code:
#!/usr/bin/perl
use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);
use strict;
use DBI;
use CGI qw(:all);
my $query = new CGI;
my $name="Joe X";
my $buddy = "more Numbers XY";
my $cookie1 = $query->cookie(-name=>'name',
-value=>"$name",
-expires=>'+4h',
-path=>'/');
my $cookie2 = $query->cookie(-name=>'buddy',
-value=>"$buddy",
-expires=>'+4h',
-path=>'/');
print $query->header(-cookie=>[$cookie1,$cookie2]);
my $got_cookie1 = $query->cookie('name');
my $got_cookie2 = $query->cookie('buddy');
if($f_name eq ""){$name = $got_cookie1;}
if($buddy eq ""){$buddy = $got_cookie2;}
print "<meta http-equiv=\"refresh\" content=\"2\";\ url=http://www.myp
+age.com/cgi-bin/per.pl?buddy=$buddy&name=$name\">";
print $query->redirect('http://www.mypage.com/cgi-bin/per.pl?buddy=$bu
+ddy&name=$name');
my $url = "http://www.mypage.com/cgi-bin/per.pl?buddy=$buddy&name=$nam
+e";
print "Location: $url\n\n";
print $query->end_html;
Thanks a lot!!!!
-
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.
|