chuleto1 has asked for the wisdom of the Perl Monks concerning the following question:
#one.pl #!/usr/bin/perl use strict; use CGI; my $cgi = new CGI; print $cgi->header; print $cgi->start_html('A Simple Example'), $cgi->h1('A Simple Example'), $cgi->start_form(-action=>"test.pl"), "What's your name? ",$cgi->textfield('name'), $cgi->p, $cgi->submit, $cgi->end_form, $cgi->end_html;
#test.pl #!/usr/bin/perl use strict; use CGI::Cookie; use CGI; my $cgi = new CGI; print $cgi->header( -cookie => new CGI::Cookie(-name => 'name', -value=> $cgi->param( +'name'), -expires => 'Thu, 26- +Sep-2002 00:00:00 GMT', -domain => 'students. +cs.byu.edu' ) ). $cgi->start_html(-title => 'A Simple Example', -bgcolor => $cgi->param('color')); if ($cgi->param()) { print $cgi->center( $cgi->h3("Hello: ". $cgi->param('name'))); } print $cgi->start_form(-action => "results.pl"), "What's your name? ",$cgi->textfield('name'), $cgi->p, "What's the combination?", $cgi->p, $cgi->checkbox_group(-name=>'words', -values=>['eenie','meenie','minie','moe'], -defaults=>['eenie','minie']), $cgi->p, "What's your favorite color? ", $cgi->popup_menu(-name=>'color', -values=>['red','green','blue','chartreuse']), $cgi->p, $cgi->submit('SUBMIT'), $cgi->end_form, $cgi->end_html(); exit(0);
#!/usr/bin/perl # results.pl use strict; use CGI::Cookie; use CGI; my $cgi = new CGI; print $cgi->start_html(-title => 'Results', -bgcolor => $cgi->param('color')); if ($cgi->param()) { print $cgi->center( $cgi->h3("Hello: ". $cgi->param('name')), $cgi->p, "The keywords are: ",join(", ",$cgi->param('words')), $cgi->p, "Your favorite color is: ",$cgi->param('color')); } print $cgi->end_html(); exit(0);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: I am having problems setting a Cookie
by dws (Chancellor) on Sep 21, 2002 at 17:09 UTC | |
|
Re: I am having problems setting a Cookie
by spartacus9 (Beadle) on Sep 21, 2002 at 23:21 UTC | |
|
Re: I am having problems setting a Cookie
by zengargoyle (Deacon) on Sep 22, 2002 at 00:07 UTC |