title: Keep input value after form submit (with a catch)
body: <p>In PHP, if the text input "cmtx_comment" is empty, on form submit I show a javascript alert. After I press OK in the alert, the values entered by the user in all fields in the form are gone. <strong>How can I keep the user entered values, without adding code to the value of the input elements</strong> (something like <code>&lt;input type="text" name="something" value="&lt;?php echo $_GET['something'];?&gt;"&gt;</code> ?</p>
  
  <pre><code>if (empty($cmtx_comment)) { //if comment value is empty
  echo &lt;&lt;&lt;EOD
  &lt;script&gt;
  alert('Please enter a comment!');
  &lt;/script&gt;
  EOD;
  return false;
  } else { //if comment entered
  do stuff
  </code></pre>