Here is some code I use to confirm the data from a form. I uses an array called fieldname, if there is not a matching array entry in fieldname and $_POST, then it will not display that field.
The fieldname array stores the display text for the field.. So the key is the field name, the data is the display text.
<?php
$fieldname = array (
"firstname" => "Your First Name",
"lastname" => "Your Last Name",
"email" => "Your E-Mail Address"
);
// I use the name action for my submit button, and if the value is "Submit Form" I think call the confirmform code.