Err that above post will help too, but I misread.
Sounds like you are not posting the data back into your fields:
<input name="txtBox" type="text" value="<?php echo "$data"; ?>">
That way when you post to the page (I'm assuming you're using PHP_SELF) and it craps out on you, the data will be put back into the fields so the user doesn't have to re-enter it.