I will demonstrate the solution of your problem with an example. What you need to do is add a value to each of your form inputs. This input field should be PHP parameterized to ensure that on post-back, the data is not lost. For example:
<?php
if(isset($_POST['form1'])){
if(!empty($_POST['user']) && !empty($_POST['email'])){
}
else{
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input type="hidden" name="form1" value="true" />
Username: <input type="text" name="user" value="<?php if(isset($_POST['user'])) echo $_POST['user']; ?>" /><br />
Email: <input type="text" name="email" value="<?php if(isset($_POST['email'])) echo $_POST['email']; ?>" /><br />
<input type="submit" value="Submit" />
</form>
<?php
}
}
?>
You can get more information on working with PHP post-back from
PHP.NET, which is the official PHP Documentation.