If you are using sessions (or can add sessions to your application), you could store the values in the $SESSION array. Then have your form check to see if the values exist, e.g.:
<input type="text" name="example" value="<?php
echo (isset($_SESSION['example'])) ? htmlentities($_SESSION['example'], ENT_QUOTES) : '';
?>" />
Another technique is to use the same script for both displaying and processing the form. Then via use of if/else conditions you can choose whether or not to display the form, using the same technique as above for displaying values but using the $_POST array (or $GET if the get method was used) instead of the $SESSION array.
<?php
if(isset($_POST['some_field'])
{
// validate form, save error messages in $error array, then...
if($isValid)
{
// process results, then...
header('http://www.example.com/thank_you.php');
exit;
}
}
?>
<!-- input form -->
<?php
if(!empty($errors))
{
echo "<p class='error'>" . implode(' ', $error) . "</p>\n";
?>
<form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='post'>
<input type="text" name="example" value="<?php
echo (isset($_POST['example'])) ? htmlentities($_POST['example'], ENT_QUOTES) : '';
?>" />
</form>