Why don't you create the form in a file (say form.php). This form can detect whether an action is set, if so, it populates all the field names with their own values.
Then pass it to handler.php.
Handler detects your condition, sets an action (see above), shows an error message, and then goes include("form.php").
Form then fills itself out with the data that was just passed.
Get me?
HTH 🙂