programming-examples/perl/CGI/Sessions - Preserving State.pl
2019-11-15 12:59:38 +01:00

41 lines
864 B
Perl

<html>
<head>
<title>Hidden Fields</title>
</head>
<body>
<H3>Sessions - Preserving State</H3>
<br><br>
<H3>Page 1</H3>
<form name="myform1" method="post" action="index.pl">
Enter your First Name: <input type="text" name="firstname">
<input type="submit" name="submit" value="Go to Page 2!">
</form>
</body>
</html>
File: index.pl
#!c:/perl/bin
use CGI;
$q1 = new CGI;
print $q1->header;
$firstname = $q1->param('firstname');
print "<H3>Sessions - Preserving State</H3>";
print "<br><br>";
print "<H3>Page 2</H3>";
print "Hello $firstname <br><br>";
print "<form name=myform2 method=post action=index.pl>";
print "<input type=hidden name=firstname value=$firstname>";
print "Enter your e-mail address: <input type=text name=email>";
print "<input type=submit name=submit value='Go to page 3!'>";
print "</form>";