Form Validation using Javascript inside PHP
<p>I have a simple problem but no matter what I try I can't see to get it to work. I have a form on a php page and I need to validate the qty value on my form so that it doesn't exceed $qty (value pulled from mySQL) and is not less than zero. Sounds easy--hmm wish it were..lol! I had it checking if the value was numeric and in my attempts to make this work I even broke that--not a good morning..lol!</p>

<p>Here's a snip of my JavaScript Fn:</p>

<pre><code>&lt;script type='text/javascript'&gt;
    function checkQty(elem){
        var numericExpression = /^[0-9]+$/;
        if(elem.value.match(numericExpression)){
                return true;
            }else{
                alert("Quantity for RMA must be greater than zero and cannot be more than the original order!");
                elem.focus();
                return false;
        }
    }
    &lt;/script&gt;
</code></pre>

<p>The function is called from the submit button, onClick:</p>

<pre><code>&lt;input type="submit" name="submit" onclick="checkQty(document.getElementById('qty')";"&gt;  
</code></pre>

<p>I've tried:</p>

<pre><code>var numericExpression = /^[0-9]+$/;
if(elem.value.match(numericExpression) || elem.value &lt; 0 || elem.value &gt; &lt;? int($qty) ?&gt;){
</code></pre>

<p>No dice....HELP!?! </p>
