Separate the form and perl script
#!c:/perl/bin use CGI; $q1 = new CGI; print $q1->header; $firstname = $q1->param('firstname'); $email = $q1->param('email'); print "<H3>Sessions - Preserving State</H3>"; print "<br><br>"; print "<H3>Page 3</H3>"; print "Hello $firstname <br><br>"; print "Your email address is: $email <br><br>"; print "<form name=myform3 method=post action=index.pl>"; print "<input type=hidden name=firstname value=$firstname>"; print "<input type=hidden name=email value=$email>"; print "Enter your post code: <input type=text name=postcode>"; print "<input type=submit name=submit value='Go to page 4!'>"; print "</form>"; ############################ #!c:/perl/bin use CGI; $q1 = new CGI; print $q1->header; $firstname = $q1->param('firstname'); $email = $q1->param('email'); $postcode = $q1->param('postcode'); print "<H3>Sessions - Preserving State</H3>"; print "<br><br>"; print "<H3>Page 4</H3>"; print "Hello $firstname <br><br>"; print "Your email address is: $email <br><br>"; print "Your Postcode is: $postcode <br><br>"; print "Hi";