You're not giving people a lot to go on, which makes it difficult to help you.
I'm assuming you have a form of some sort. I'm assuming it has a Submit button on it at present, which saves the form fields somewhere.
If you want to have the option of a preview, you need to add a second button, which you'll probably want to label "Preview".
Now, I would suggest making the form's action post back to the same page. That way, if there is any validation error you can simply display the form again, with the values that have been input.
When you show the preview you will probably be just outputing text to the browser. This means that you need to store the form data somewhere so it can be saved after the user sees the preview. You could either use session variables, or <input type="hidden">.
Here's a very rough example:
<?php
//Check if field has been posted.
if (isset($_POST["name"]))
$name=$_POST["name"];
else
$name="";
//Check the required fields have been entered.
if (strlen($name)==0)
$valid=false;
else
$valid=true;
//Respond to buttons.
if ($valid && isset($_POST["submit"])) {
//Put code to save here.
echo "Form saved.";
}
else if ($valid && isset($_POST["preview"])) {
//Display preview data.
echo "<form action=\"preview.php\" method=\"post\">";
echo "You have entered: $name.";
//Put data in hidden fields to be retrieved later.
echo "<input type=\"hidden\" name=\"name\" value=\"$name\">";
echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">";
echo "<input type=\"submit\" name=\"edit\" value=\"Edit\">";
echo "</form>";
}
else {
//Display the form.
echo "<form action=\"preview.php\" method=\"post\">";
echo "Enter your name: <input name=\"name\" value=\"$name\">";
echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">";
echo "<input type=\"submit\" name=\"preview\" value=\"Preview\">";
echo "</form>";
}
?>
Hope this helps!
James