PHP Session with multi-page form?

Hello all:

I’m building a 4 page form where each page has it’s own unique form fields and upon completion of the forms, all of the content is emailed. It’s emailing all of the info just fine, but I’m trying to use PHP Sessions for the first time to remember form values and am having some problems.

Each page of has a back and/or next button, but right now when you go back, the data that the user had entered in the fields disappears. My question is, how do I utilize PHP Sessions in order to enable the forms to hold the data that the user enters?

The file structure consists of 4 pages (index.php, delivery.php, product.php, and confirmation.php). At the top of index.php I have <?php session_start(); ?> and on confirmation.php, I have <?php session_destroy(); ?> after all of the content has been emailed.

I’m pretty sure I need to use either $_session or $HTTP_SESSION_VARS, but I’m just not sure how. The url is www.potty4u.com/event_quote/index.php. Below is a sample of the code I have for index.php.


<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Rent-A-John Event Quote Form</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script src="script.js"></script>
<style type="text/css">
#leftColumn{
float:left;
width:150px;
text-align:right;
}

#rightColumn{
float:left;
width:375px;
text-align:left;
margin:0px 0px 0px 65px;
height:535px;
}

.city{
width:200px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
color:#5c5b5b;
padding:2px;
margin-top:3px;
}

.state{
width:35px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
color:#5c5b5b;
margin-top:3px;
padding:2px;
}

.zip{
width:43px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
color:#5c5b5b;
padding:2px;
margin-top:3px;
}

.next{
margin:0px 0px 0px 237px;
}
</style>
</head>

<body>
<table align="center" width="100%" height="100%">
<tr>
<td align="center" valign="middle">
<div id="container">
<img src="images/header.jpg" alt="Rent-A-John Event Quote Form" class="header" />
<div id="leftColumn"><img src="images/one.jpg" alt="Step One" width="88" height="88" class="steps" /><img src="images/two_opaque.jpg" alt="Step Two" width="88" height="88" class="steps" /><img src="images/three_opaque.jpg" alt="Step Three" width="88" height="88" class="steps" /><img src="images/four_opaque.jpg" alt="Step Four" width="88" height="88" class="steps" /></div>
<div id="rightColumn">
<h1>Personal Information</h1><p>*Required Fields</p><br />
<form name="form" method="post" action="delivery.php" class="form" onsubmit="javascript:return validatePersonal()"><p>
*Your Name:<br /><input name="name" type="text" class="mostForms"/>
<br /><br />
*Your Address:<br /><input name="pad1" type="text" class="mostForms"/>
<br /><input name="pad2" type="text" class="mostForms"/>
<br /><br />
*City:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*State: &nbsp;*Zip:<br /><input name="pcity" type="text" class="city"/> 
&nbsp;<input name="pstate" type="text" class="state"/> 
&nbsp;<input name="pzip" type="text" class="zip"/>
<br /><br />
*Phone (xxx)xxx-xxxx:<br /><input name="pphone" type="text" class="mostForms"/>
<br /><br />
Fax (xxx)xxx-xxxx:<br /><input name="pfax" type="text" class="mostForms"/>
<br /><br />
*Email:<br />
<input name="email" type="text" class="mostForms"/>
<br />
<br />
<input type="image" class="next" src="images/next_btn.jpg" alt="Next"/>
</form>
</p>
</div>
<div id="footer"><img src="images/footer.jpg" alt="Rent-A-John" class="footer" /></div>
</div>
</td>
</tr>
</table>
</body>
</html>

Any help would be greatly appreciated. Thanks so much.

JPearson311