title: How to clear the textarea after form submission
body: <p>I am new to php! I have a contact form. I need to clear all the fields after the submission of the form. The textarea doesnt get cleared with the form when the form is submitted. Here is the code. Please tell me where need I change the code. Please help me how to clear the textarea.</p>
  
  <pre><code>&lt;?php
  
  
      if (isset($_POST['submit'])) {
      $error = "";
  
      if (!empty($_POST['name'])) {
      $name = $_POST['name'];
      } else {
      $error .= "You didn't type in your name. &lt;br /&gt;";
      }
  
      if (!empty($_POST['email'])) {
      $email = $_POST['email'];
        if (!preg_match("/^[_a-z0-9]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/i", $email)){ 
        $error .= "The e-mail address you entered is not valid. &lt;br/&gt;";
        }
      } else {
      $error .= "You didn't type in an e-mail address. &lt;br /&gt;";
      }
  
  
  
  
  
      if (!empty($_POST['message'])) {
      $message = $_POST['message'];
      } else {
      $error .= "You didn't type in a message. &lt;br /&gt;";
      }
  
  
      if(($_POST['code']) == $_SESSION['code']) { 
      $code = $_POST['code'];
      } else { 
      $error .= "The captcha code you entered does not match. Please try again. &lt;br /&gt;";    
      }
  
  
  
      if (empty($error)) {
      $from = 'From: ' . $name . ' &lt;' . $email . '&gt;';
      $to = "abc@gmail.com";
      $subject = " contact form message";
      $content = $name . " has sent you a message: \n 
  
   Email:  $email \n   
  
   Message:  $message " ;
  
      $success = "&lt;b&gt;Thank you! Your message has been sent!&lt;/b&gt;";
      mail($to,$subject,$content,$from);
  
      }
      }
      ?&gt;
  
                &lt;div id="contactForm"&gt;
  
  
  
                  &lt;?php
        if (!empty($error)) {
        echo '&lt;p class="error"&gt;&lt;strong&gt;Your message was NOT sent&lt;br/&gt; The following error(s) returned:&lt;/strong&gt;&lt;br/&gt;' . $error . '&lt;/p&gt;';
        } elseif (!empty($success)) {
        echo $success;
        }
      ?&gt;
  
              &lt;form action="contact.php" method="post"  style="margin-top:20px;"&gt;
                &lt;input type="hidden" name="subject" value="Form Submission" /&gt;
                &lt;input type="hidden" name="redirect" value="contact.php" /&gt;
  
                &lt;label style="font-size:14px;"&gt;Name:&lt;/label&gt;
                &lt;input type="text" name="name" value="" style="margin-left:36px;" &lt;?php if (isset($_POST['name'])) { echo $_POST['name']; } ?&gt;" /&gt;
                  &lt;br/&gt;
                  &lt;br/&gt;
  
                &lt;label style="font-size:14px;"&gt;E-mail:&lt;/label&gt;
                &lt;input type="text" name="email" value="" style="margin-left:30px;"&lt;?php if (isset($_POST['email'])) { echo $_POST['email']; } ?&gt;" /&gt;
                  &lt;br/&gt;
                  &lt;br/&gt;
  
  
  
  
                &lt;label style="float:left; margin-right:10px; font-size:14px"&gt;Comment:&lt;/label&gt;
                &lt;textarea name="message" rows="10" cols="30" wrap="hard"&gt;
                  &lt;?php  if (isset($_POST['message'])) { echo $_POST['message']; } ?&gt;
                &lt;/textarea&gt;
                  &lt;br/&gt;
                  &lt;br/&gt;
  
                &lt;label style="margin-left:2px;"&gt;
                  &lt;img src="captcha.php" style="margin-top:10px;"&gt;
                &lt;/label&gt;
                &lt;input type="text" name="code" style="margin-left:23px;"&gt;
                  &lt;br /&gt; &lt;br /&gt;
  
                  &lt;input type="submit" class="submit" name="submit" value="SEND" /&gt;
  
                &lt;/form&gt;
  </code></pre>