title: Clear input text after executing some PHP code
body: <p><strong>PHP Code :</strong></p>
  
  <pre><code>&lt;?php
      if(isset($_POST['submit']))
      {
         $sent = mail($to, $subject, $email_message, $headers) ;
  
         if($sent)
         {
          echo '&lt;script&gt; cleartext(); &lt;/script&gt;';
         }
  
      }
  ?&gt;
  </code></pre>
  
  <p><strong>JavaScript :</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      function cleartext()
      {
           alert(document.getElementById('name').value);
           document.getElementById('name').value = '';
           document.getElementById('email').value = '';
           document.getElementById('phone').value = '';
           document.getElementById('message').value = '';
  
           alert(document.getElementById('name').value);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Source Code :</strong></p>
  
  <pre><code>&lt;form action="#" method="post" class="margin-bottom" target="hidden" id="contact"&gt;
   &lt;div class="row"&gt;
        &lt;div class="col-lg-6  col-sm-6"&gt;
              &lt;input type="text" placeholder="Your Name*" id="name" name="name" /&gt;
        &lt;/div&gt;
        &lt;div class="col-lg-6  col-sm-6"&gt;
            &lt;input type="text" placeholder="Your Email*" id="email" name="email" /&gt;
        &lt;/div&gt;
        &lt;div class="col-lg-6 col-sm-6"&gt;
             &lt;input type="text" placeholder="Your Phone*" id="phone" maxlength="13" name="phone" /&gt;
        &lt;/div&gt;
    &lt;/div&gt;
  
  &lt;textarea placeholder="Message" id="message" name="message"&gt;&lt;/textarea&gt;
  
      &lt;input type="submit" id="clear" name="clear" class="button" value="Clear &amp;nbsp;&amp;nbsp;&amp;nbsp;" onClick="cleartext();"&gt;
      &lt;input name="submit" type="submit" class="button" id="submit" onClick="MM_validateForm('name','','R','email','','RisEmail','phone','','RisNum','message','','R');return document.MM_returnValue" value="Submit &amp;nbsp;&amp;nbsp;&amp;nbsp;"&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>Problem</strong></p>
  
  <p>I want to clear all input text after sending a mail on submit.on submit I am calling <code>cleartext()</code> from my <code>PHP</code> code.but on that time I am not being able to clear my input text value.And when I call <code>cleartext()</code> method on clear button it's works proper.if somebody have idea about it so please help me.</p>