title: PHP Keep entered values after validation error
body: <p>I have a simple form that needed validation. <br>
  I did this with the <code>empty()</code> function. If the validation doesn't pass it gives the user an alert. As soon as this alert is created all entered values are gone.</p>
  
  <p>I would like to keep them.</p>
  
  <p>This is what I did:</p>
  
  <pre><code>&lt;form id="" name="" action="&lt;?php echo get_permalink(); ?&gt;" method="post"&gt;
      &lt;table&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  Name:&lt;input type="text" id="name" name="name"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;input class="submit-button" type="submit" value="Send" name="submit"&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/form&gt;
  &lt;?php
      if($_POST["submit"]){
          if (!empty ($_POST["name"])){
            // do something
          }else{
              ?&gt;
              &lt;script type="text/javascript"&gt;
                  alert('U heeft niet alle velden ingevuld. Graag een volledig ingevuld formulier versturen');
              &lt;/script&gt;
              &lt;?php
          }
  ?&gt;  
  </code></pre>