title: Keep form data inside input fields after form error checking
body: <p>I have a small form, Im doing some simple error checking with php and all looks to be well but I notice when users submit the form, after the error checking happens all data is removed from the fields.</p>
  
  <p>Here is what I have</p>
  
  <pre><code>&lt;?php if($show=="true"):?&gt;
  &lt;input name="fname" type="text" value="&lt;?php if(isset($_POST['name']){echo $_POST['name';]})?&gt;"&gt;&lt;?php echo $errorname; ?&gt;
  
  &lt;input name="email" type="text" value="&lt;?php if(isset($_POST['name']){echo $_POST['name';]})?&gt;"&gt;&lt;?php echo $erroremail; ?&gt;
  &lt;input type="submit" value="submit"&gt;
  &lt;?php else: ?&gt;
  &lt;h2&gt;Your Message was sent&lt;/h2&gt;
  
   &lt;?php endif;?&gt;
  &lt;?php
      if(empty($_POST['name'])){
           $show="true";
           $errorname="please enter your name";
       }
       elseif(empty($_POST['email'])){
          $show=true;
          $erroremail="please end your email";
       }else
          $show=false;
          //Send data as email;
  
      ?&gt;
  </code></pre>