This is just my preferred way of doing things, but I like to submit the form to itself. That way, I can serialize the form values without having to rely on sessions. I even like to write functions that render the html for the inputs, just so it's easier to show the input control with the last chosen value. Here is a basic framework.
<?php
if (isset($_POST['submit'])) {
//handle form
//if everything looks good, do your processing and then redirect to a thankyou page.
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="POST">
<!--for a text box it's easy...-->
<input type="text" value="<?php echo $_POST['txtname']?>" name="txtname">
<!--For a select you can go about it in different ways-->
<!--If statements for selecting value from last post-->
<select name="mnuoptions">
<option <?php echo ($_POST['mnuoptions']==1) ? " selected" : ""?>>1</option>
<option <?php echo ($_POST['mnuoptions']==2) ? " selected" : ""?>>2</option>
<option <?php echo ($_POST['mnuoptions']==3) ? " selected" : ""?>>3</option>
</select>
<!--This is a good opportunity to write a function-->
<?php
function select_on_post_match($postkey, $current)
{
echo ($_POST[$postkey]==$current) ? " selected" : "";
}
?>
<!--Now we can just call the function-->
<select name="mnuoptions">
<option <?php select_on_post_match("mnuoptions", "1");?>>1</option>
<option <?php select_on_post_match("mnuoptions", "2")?>>2</option>
<option <?php select_on_post_match("mnuoptions", "3")?>>3</option>
</select>
<!--Or...you can make a function that just handles it all at once.-->
<?php
function makemenu($name, $options)
{
$out = "<select name=\"$name\">\n";
foreach ($options as $option) {
$out .= "<option";
$out .= ($_POST[$name]==$option) ? " selected" : "";
$out .= ">$option</option>\n";
}
$out .= "</select>\n";
return $out;
}
?>
<!--now you can replace the whole select html part with...-->
<?php echo makemenu("mnuoptions", array("1","2","3"));?>
<input type="submit" name="submit" value="submit">
</form>
I wrote all this stuff quickly and off the top of my head so if you end up using it, you may need to debug it slightly.