Issue with the BACK button
<p>I am very new to PHP programming infact its just been 3 days since I started so I need your help .
I am creating a form which contains 4 pages . When user clicks on Back button , for example from page 2 to page 1 all the data which he previously selected on page1 should be be present there so that he need not fill it again . 
Could you please help me with this by posting the code . </p>

<p>Here is the sample code </p>

<p>page1.php</p>

<pre><code>&lt;?php
session_start();
$session=session_id();
$_SESSION['session']=$session;

    ?&gt;
    &lt;html&gt;
    &lt;body&gt;
    &lt;form action="oopssurvey.php" method="post"&gt;
    Where do you work?&lt;br/&gt;
    &lt;Input type ="radio" name="location" value="USA" &lt;?php if($_SESSION['location']    == 'USA') echo "checked='checked'" ?&gt;/&gt;In the United states&lt;br/&gt;
    &lt;Input type ="radio" name="location" value="India" &lt;?php if($_SESSION['location'] == 'India') echo "checked='checked'" ?&gt;/&gt;Outside of the United states&lt;br/&gt;

    &lt;input name="Operation1" type="submit" value="saveandresume" /&gt;
    &lt;input name="Operation2" type="submit" value="next" /&gt;

    &lt;/form&gt;
    &lt;/body&gt;
    &lt;/html&gt;
</code></pre>

<p>page2.php</p>

<pre><code>&lt;?php
session_start();

if($_SESSION['session']==$session)
{
$location=$_SESSION['location'];
}
else
{
$_SESSION['location'] = $_POST['location'];
}
?&gt;

&lt;html&gt;

&lt;body&gt;

&lt;form action="oopssurvey.php" method="post"&gt;

In my work group, we are actively involved in making our work processes more effective and efficient (simpler, faster, etc.) using ACE.&lt;br/&gt;
&lt;Input type ="radio" name="effective" value="Agree"/&gt;Agree&lt;br/&gt;
&lt;Input type ="radio" name="effective" value="Agreenordisagree"/&gt;Neither Agree nor Disagree&lt;br/&gt;
&lt;Input type ="radio" name="effective" value="disagree"/&gt;Disagree&lt;br/&gt;

I have received the training I need to understand and implement ACE in my work group.&lt;br/&gt;
&lt;Input type ="radio" name="training" value="Agree"/&gt;Agree&lt;br/&gt;
&lt;Input type ="radio" name="training" value="Agreenordisagree"/&gt;Neither Agree nor Disagree&lt;br/&gt;
&lt;Input type ="radio" name="training" value="disagree"/&gt;Disagree&lt;br/&gt;

All employees at the company are treated fairly regardless of differences.&lt;br/&gt;
&lt;Input type ="radio" name="treated" value="Agree"/&gt;Agree&lt;br/&gt;
&lt;Input type ="radio" name="treated" value="Agreenordisagree"/&gt;Neither Agree nor Disagree&lt;br/&gt;
&lt;Input type ="radio" name="treated" value="disagree"/&gt;Disagree&lt;br/&gt;

Sufficient effort is made to get the opinions and thoughts of the people who work here.&lt;br/&gt;
&lt;Input type ="radio" name="effort" value="Agree"/&gt;Agree&lt;br/&gt;
&lt;Input type ="radio" name="effort" value="Agreenordisagree"/&gt;Neither Agree nor Disagree&lt;br/&gt;
&lt;Input type ="radio" name="effort" value="disagree"/&gt;Disagree&lt;br/&gt;

&lt;input name="Operation3" type="submit" value="saveandresume" /&gt;
&lt;input name="Operation4" type="submit" value="next" /&gt;
&lt;input name="Operation5" type="submit" value="back" /&gt;

&lt;/form&gt;

&lt;/body&gt;

&lt;/html&gt;
</code></pre>

<p>page3.php</p>

<p>//somecode//</p>

<p>Survey.php</p>

<pre><code>&lt;?php
session_start();
include 'classperson.php';


if($_POST['Operation1'])
{
$_SESSION['location'] = $location;
$_SESSION['location'] = $_POST['location'];
echo "Please save the link inorder to continue your survey http://bonnie/~jnagesh/SampleSurvey/OOPS/oopspage2.php";
}

else if($_POST['Operation2'])
{
$_SESSION['location'] = $location;
$_SESSION['location'] = $_POST['location'];
include "oopspage2.php";
}


elseif($_POST['Operation3'])

{
$_SESSION['effective'] = $effective;
$_SESSION['effective'] = $_POST['effective'];
$_SESSION['training'] = $training;
$_SESSION['training'] = $_POST['training'];
$_SESSION['treated'] = $treated;
$_SESSION['treated'] = $_POST['treated'];
$_SESSION['effort'] = $effort;
$_SESSION['effort'] = $_POST['effort'];
echo "Please save the link inorder to continue your survey later http://bonnie/~jnagesh/SampleSurvey/NextandBackButtons/page3.php";

}

elseif($_POST['Operation4'])
{
$_SESSION['effective'] = $effective;
$_SESSION['effective'] = $_POST['effective'];
$_SESSION['training'] = $training;
$_SESSION['training'] = $_POST['training'];
$_SESSION['treated'] = $treated;
$_SESSION['treated'] = $_POST['treated'];
$_SESSION['effort'] = $effort;
$_SESSION['effort'] = $_POST['effort'];
include "oopspage3.php";
}

elseif($_POST['Operation5'])     /* THE PROBLEM LIES IN THIS CODE FOR BACK BUTTON*/
{
$location = $_POST['location'];
$_SESSION['location'] = $location;
&lt;html&gt; 
&lt;body&gt; 
&lt;form action="1.php" method="post"&gt; /*oBVIOUSLY i WONT BE ALLOWED TO DECLARE &lt;HTML&gt; INSIDE PHP*/
&lt;input type="submit" value="back"/&gt;
&lt;/form&gt; 
&lt;/body&gt; 
}
</code></pre>

<p>.
.
.
.
.
.
.
.
?></p>

<p>could you please help me how to implement the back button . 
Thanks in advance</p>
