|
I'm trying to store cookies but its not working with the code I have. Do anyone see any errors?
<!c11ex4.html> <HTML> <HEAD><TITLE>Maribeth Designs</TITLE></HEAD> <BODY> <H1>Select a Background Color</H1> <FORM ACTION="http://servername.netfirms.com/cgi-bin/c11/c11ex4a.cgi" METHOD=GET> <P> <INPUT TYPE=radio NAME=Color VALUE=hotpink>Pink<BR> <INPUT TYPE=radio NAME=Color VALUE=silver>Silver<BR> <INPUT TYPE=radio NAME=Color VALUE=tan>Tan<BR> <INPUT TYPE=radio NAME=Color VALUE=white>White<BR> </P> <INPUT TYPE=submit VALUE="Color Choice"> </FORM></BODY></HTML> --------------------- #!/user/bin/perl #c11ex4a.cgi - first script use CGI qw(:standard); #prevent Perl from creating undeclared variables use strict; #declare and assign value to variable my ($color, $C_color); $color = cookie('Color'); #create and send cookie $C_color = cookie(-name => "Color", -value => "$color"; -path => "/cgi-bin/c11"); print header(-cookie => $C_color); #create Web page print "<HTML>\n"; print "<HEAD><TITLE>Maribeth Designs</TITLE></HEAD>\n"; print "<BODY BGCOLOR=$color>\n"; print "<HR>\n"; print "<FORM ACTION='http://servername.netfirms.com/cgi-bin/c11/c11ex4b.cgi' METHOD=POST>\n"; print "<H1>Maribeth Designs</H1>\n"; print "<I>Welcome to our Web site!</I><BR><BR><BR>\n"; print "<INPUT TYPE=submit VALUE='Go to Next Page'>\n"; print "</FORM>\n"; print "</BODY></HTML>\n"; --------------------- #!/user/bin/perl #c11ex4b.cgi - second script print "Content-type: text/html\n\n"; use CGI qw(:standard); #prevent Perl from creating undeclared variables use strict; #declare variable my $color; #assign value to variable and retrieve Color cookie $color = cookie('Color'); #create Web page print "<HTML>\n"; print "<HEAD><TITLE>Maribeth Designs</TITLE></HEAD>\n"; print "<BODY BGCOLOR=$color>\n"; print "<HR>"; print "<H1>Maribeth Designs</H1>\n"; print "<I>Thank you for visiting our Web site!</I>\n"; print "</BODY></HTML>\n";
|