title: PHP validation resets the form fields
body: <pre><code>if(isset($_POST['submit'])){
  
  $domain=$_POST['domain'];
  $fname=$_POST['fname'];
  $sname=$_POST['sname'];
  $tel=$_POST['tel'];
  if($domain==""){
      $error="&lt;h4&gt;Enter Domain &lt;/h4&gt;";    
  }elseif($fname == ""){
      $error="&lt;h4&gt;Enter Firstname &lt;/h4&gt;"; 
  }elseif($sname == "")
  {
      $error="&lt;h4 &gt;Enter Surname&lt;/h4&gt;";   
  }elseif($tel=="")
  {
      $error="&lt;h4 &gt;Enter telephono no&lt;/h4&gt;";  
  }
  else {
  
  $sql11=mysql_query("INSERT INTO domain VALUES('','$domain','$fname','$sname','$tel','$mobile','$email','$company','$address','$city','$country','$pcode','$tele',
  '$fax','$qus','$ans')");
  echo $sql;
  $db-&gt;query($sql);
  
      }
      }
  &lt;div&gt;&lt;?php echo $error; ?&gt;&lt;/div&gt;
  &lt;form action="" method="post" name="classic_form" id="classic_form"&gt;
  &lt;div&gt;&lt;h4&gt;Personal details:&lt;/h4&gt;&lt;/div&gt;&lt;div style="margin-left: 109px;"&gt;
            &lt;div&gt;Domain&lt;/div&gt;
      &lt;input type="text" name="domain" id="domain" value="" /&gt;
      &lt;div&gt;First name: &lt;/div&gt;
      &lt;input type="text" name="fname" id="fname" value="" /&gt;
      &lt;div&gt;Surname:&lt;/div&gt;
       &lt;input type="text" name="sname" id="sname" value="" /&gt;
       &lt;div&gt;Telephone:&lt;/div&gt;
      &lt;input type="text" name="tel" id="tel" value="" /&gt;
      &lt;div&gt;Mobile:&lt;/div&gt;
      &lt;/form&gt;
  </code></pre>
  
  <p>In my registration page, i used php validation. After the user submit the form if it shows validation errors it also resets all the fields. How can i resolve this problem? Without reset the fields i have to show the php validation errors. I also used  in each input value. But it shows 
      "Notice: Undefined index: domain in D:\xampp\htdocs\deena\domainreg.php on line 82" . Please help me to resolve this problem</p>