title: Validating PHP form and change submit button instead of redirect to status page
body: <p>I have a basic PHP form here that sends an email when submitted:</p>
  
  <pre><code>&lt;div id="contact"&gt;
  &lt;form id="contact_form" action="&lt;?=base_url()?&gt;contact/email_form" method="post" name="contact"&gt;
      &lt;h4&gt;Questions? Comments?&lt;/h4&gt;
      &lt;p&gt;
          &lt;label&gt;Name&lt;/label&gt;
          &lt;input name="name" id="name" type="text" class="text" /&gt;
      &lt;/p&gt;
      &lt;p&gt;
          &lt;label&gt;Email&lt;/label&gt;
          &lt;input name="email" id="email" type="text" class="text" /&gt;
      &lt;/p&gt;
      &lt;p class="message"&gt;
          &lt;label&gt;Question&lt;/label&gt;
          &lt;textarea name="message" id="message" rows="5" cols="5"&gt;&lt;/textarea&gt;
      &lt;/p&gt;
      &lt;p class="alt"&gt;
  
          &lt;input value="Send Info" id="submitbutton" type="submit"&gt;
      &lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p></p>
  
  <p>This form works well but I currently have no validation so if the form is submitted even when the fields are blank.  Isn't it possible to do validation with jquery?</p>
  
  <p>Once the form is submitted it POSTS to a controller file in codeigniter  which does the emailing logic using an email helper in codeigniter.  See here:</p>
  
  <pre><code>if($this-&gt;email-&gt;send())
      {
          echo 'Message has been sent';
      }
      else
      {
          show_error($this-&gt;email-&gt;print_debugger());
      }
  </code></pre>
  
  <p>As you can see this redirects to the email_form view and echos the results.  Is it possible to just stay on the same contact page that has the form and have the results of the post show there instead of redirecting to the <code>&lt;?=base_url()?&gt;contact/email_form</code> view?  I was thinking of having the Text of the SUBMIT button change to "Message Sent" or something like that and then clearing the form fields.  This way they stay on the contact page.</p>
  
  <p>Is all of this possible with jquery? Thanks!</p>