When you submit the form, you get all the data from the form in PHP variables.
Either globals or $HTTP_GET/POST_VARS arrays.
You can simply re-print the html form, and print the content of these variables in the html tags:
The form:
print "<form action=bla.php>";
print "<input name=firstname>";
print "<input type=submit>";
print "</form>";
The form when some data is missing or wrong:
print "<form action=bla.php>";
print "<input name=firstname value=$firstname>";
print "<input type=submit>";
print "</form>;
You can do the same for check- and radioboxes:
<input type=checkbox name=bla checked>bla
and selectboxes:
<select name=a>
<option value=blabla>
<option value=booboo selected>
</select>