Multi-page form and sessions.
Posted: Mon Aug 16, 2004 10:29 am
I have a 4 page form with a summary page at the end before final submittal. I have decided to use sessions in case someone wanted to go back and edit information before submitting the form. I'm using links on the summary page to go back to the desired page to edit. I have come across a couple of problems, 1 of which I figured out a fix but I'm not sure if it's the easiest way. The 2 problems I have come across is,
1. person fills out page 1 and moves to page 2, they then fill out page 2 and realize they need to edit something on page 1 so they hit the back button on the browser. When they edit page 1 and click next, the information on page 2 is no longer there. Is there around this?
2. When the person gets to the summary page and click on a link to edit information on any given page, the info wasn't there at which time I felt pretty stupid in forgetting to set the info according to the session info, so I added some code,
and then the input box
Which works fine, but with all of the inputs, is there an easier way to do this? without having to set every session as null and coding every input box that way?[/u]
1. person fills out page 1 and moves to page 2, they then fill out page 2 and realize they need to edit something on page 1 so they hit the back button on the browser. When they edit page 1 and click next, the information on page 2 is no longer there. Is there around this?
2. When the person gets to the summary page and click on a link to edit information on any given page, the info wasn't there at which time I felt pretty stupid in forgetting to set the info according to the session info, so I added some code,
Code: Select all
<?php
session_start();
header("Cache-control: private");
if (!isset ($_SESSION['domain']))
{
$_SESSION['domain'] =NULL;
}
?>Code: Select all
<? print "<input name="Domain" type="text" id="Domain" value="{$_SESSION['domain']}">" ?>