title: Confused with PHP form validation practices
body: <p>I am new to PHP and have only spent two weeks into it.  I am currently reading "<em>PHP and MySQL Web Development</em>" but I am lost in what I should do in regards to form validation on a present site I am working on.  I did decide to use HTML5Boilerplate for the first time and everything is coded and works great but I cant seem to figure out how to do my form.  In my form all I am requiring is <code>Name</code> <code>email</code> and <code>message</code> and I am using the <code>$_post</code> method.  </p>
  
  <ul>
  <li>Many tutorials suggested I use an array for <code>$name</code>, <code>$email</code>, and
  <code>$message</code> but I wanted to know if this is a best practice?</li>
  <li>Should I still include JavaScript validation as a fallback?</li>
  <li>If I use PHP is there a way to treat all submitted content as text or is that default in PHP?</li>
  <li>I am wanting to create a simple form captcha with <code>2+2</code> that would
  require an input box of <code>4</code> and I was wondering is the best way to do
  that with <code>if ($_POST['submit'] &amp;&amp; $human == '4')</code>?</li>
  <li>I have read several comments on using <code>$email =
  htmlspecialchars</code> is bad can someone explain why?</li>
  </ul>
  
  <p>My apologies for the thread but I have read over the week several (I beleive 15) tutorials on PHP form validation they all have their pros and cons and I want to start using PHP right.  I did try to implement <a href="http://www.ericmmartin.com/projects/simplemodal-demos/" rel="nofollow">Eric Martin's</a> form in my BoilerPlate but it would not work nor did I receive any browser errors in Firefox.</p>
  
  <p>If it helps these are some tutorials I have read: </p>
  
  <ol>
  <li><a href="http://www.tangledindesign.com/blog/how-to-create-a-contact-form-using-html5-css3-and-php/" rel="nofollow">How to Create a Contact Form using HTML5, CSS3 and PHP</a></li>
  <li><a href="http://www.hongkiat.com/blog/ajax-html5-css3-contact-form-tutorial/" rel="nofollow">How To Create An Ajax-Based HTML5/CSS3 Contact Form</a></li>
  <li><a href="http://www.developerdrive.com/2011/09/integrating-html5-css-and-php-to-create-a-very-basic-contact-form/" rel="nofollow">Integrating HTML5, CSS and PHP to Create a Very Basic Contact Form</a></li>
  <li><a href="http://www.1stwebdesigner.com/tutorials/custom-php-contact-forms/" rel="nofollow">How to Create Kick-Ass PHP Contact Forms</a></li>
  </ol>