title: How can I check if form input is numeric in PHP?
body: <p>I need to be able to see if a form input in PHP is numeric.  If it is not numeric, the website should redirect.  I have tried is_numeric() but it does not seem to work.</p>
  
  <p>Code examples will be nice.</p>
  
  <p>I am developing a shopping cart that accepts an integer value for the quantity. I am trying this: </p>
  
  <pre><code>if(!is_numeric($quantity)){
                  //redirect($data['referurl']."/badinput");
                  echo "is not numeric";
          }
  </code></pre>