title: Check whether the email textbox value exists in database
body: <p>I want to check the value in text box is present in database and clear the box if the value exists in the database without refreshing the whole page.</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;p&gt;Email&lt;input type="text" name="email" id="email" size=18 maxlength=50 required&gt;&lt;/p&gt;
  </code></pre>
  
  <p><strong>Query:</strong></p>
  
  <pre><code>$echeck="select email from register where email='$email'";
  $echk=mysql_query($echeck);
  $ecount=mysql_num_rows($echk);
  if($ecount!=0)
  {
      echo ("&lt;SCRIPT LANGUAGE='JavaScript'&gt;
      var asign=document.getElementById(email);   //now show null value
      asign.value="";                
      &lt;/SCRIPT&gt;");
  }
  </code></pre>
  
  <p>If I use alert it will refresh the page.</p>
  
  <pre><code>window.alert('Email Id already exist');
  </code></pre>