My form is working fine with the validations being done by PHP.
I have three fields: Name, EMail and Message.
Form and PHP code is within the same pgae, same page is called for validations when user submits the form.

When a user submits the form, same page is called and it checks whether the form is submitted or not.
If the form is submitted it then does the validations for blank entries and throws error message below the fields to inform user that field is left blank. It also shows error icon next to field.

Till this, it is working fine.

However, the problem, is if the user has filled any field, for example name filed and left the other two fields(EMail and Message) blank, then on submittion, it throws error messages for blank fields which is ok, but for name field which was filled by user it empty the content and shows blank name field and does not show error(as earlier user had filled it).

My only concern is that when it relods the form after submission, it should also reload the earlier values in the respective fields which user input before submitting.

Below is the PHP validation code.

```
<?php
error_reporting(E_ALL & ~E_NOTICE);

    if(isset($_POST['nameField_Name']) AND isset($_POST['nameField_EMail']) AND isset($_POST['nameField_Message']) AND isset($_POST['nameSubmit'])){  
        // Form Submited  
        if ($_POST['nameField_Name']) {
    $phpVarNameField = mysql_escape_string($_POST['nameField_Name']);
} else {
    $errormsgNameField = "Name field is required, Please enter your Name.";

}

if ($_POST['nameField_EMail']) {
    $phpVarEMailField = mysql_escape_string($_POST['nameField_EMail']);
} else {
    $errormsgEMailField = "E-Mail field is required, Please enter your E-Mail ID.";
}

if ($_POST['nameField_Message']) {
    $phpVarMessageField = mysql_escape_string($_POST['nameField_Message']);
} else {
    $errormsgMessageField = "Message field is required, Please enter your Message.";
}
    }  
?>

```

Below is the form code.

```
                <form name="myform" action="contactus.php" method="post"">
                <div id="r1">
                    <div id="r1c1">
                        <input type="text" name="nameField_Name" id="idField_Name" placeholder="Enter your name here"/>
                    </div>
                    <div id="r1c2">
                 <?php  
                      if(isset($errormsgNameField)){  // Check if $msg is not empty  
                  echo '<img src="error.png" width="45" height="45" style="margin: 5px 0px" alt="">';
                      }  
                    ?> 
                    </div>
                </div>
                <div id="afterr1">
               <?php  
                      if(isset($errormsgNameField)){  // Check if $msg is not empty  
                  echo '<div class="statusmsg" id="idErrorMsgNameField">'.$errormsgNameField.'</div>'; // Display our message and wrap it with a div with the class "statusmsg".  
                      }  
                    ?>  

                </div>
                <div id="r2">
                    <div id="r2c1">
                        <input name="nameField_EMail" type="text" id="idField_EMail" placeholder="Enter your E-Mail address here" />
                    </div>
                    <div id="r2c2">
                <?php  
                      if(isset($errormsgEMailField)){  // Check if $msg is not empty  
                  echo '<img src="error.png" width="45" height="45" style="margin: 5px 0px" alt="">';
                      }  
                    ?> 
                    </div>
                </div>
                <div id="afterr2">
                <?php  
                      if(isset($errormsgEMailField)){  // Check if $msg is not empty  
                  echo '<div class="statusmsg" id="idErrorMsgEMailField">'.$errormsgEMailField.'</div>'; // Display our message and wrap it with a div with the class "statusmsg".  
                      }  
                    ?>  
                </div>
                <div id="r3">
                    <div id="r3c1">
                        <textarea name="nameField_Message" id="idField_Message" placeholder="Enter your message for us here"></textarea>
                    </div>
                    <div id="r3c2">
                <?php  
                      if(isset($errormsgMessageField)){  // Check if $msg is not empty  
                  echo '<img src="error.png" width="45" height="45" style="margin: 115px 0px" alt="">';
                      }  
                    ?> 

                    </div>
                </div>
                <div id="afterr3">
                <?php  
                      if(isset($errormsgMessageField)){  // Check if $msg is not empty  
                  echo '<div class="statusmsg" id="idErrorMsgMessageField">'.$errormsgMessageField.'</div>'; // Display our message and wrap it with a div with the class "statusmsg".  
                      }  
                    ?>  
                </div>

                <div id="r4">
                    <div id="r4c">
                        <input type="Submit" name="nameSubmit" id="idButton_Submit" value="Submit"  alt="Submit Button"/>
                    </div>
                </div>
                </form>

```

Any help will be great on this.

Thank You.