Need help to do math with PHP and JavaScript
<p>I have the following JQuery/Javascript</p>

<pre><code>&lt;script&gt;
                var Quantity;
$("select").change(function() {
    var str = "";
    var price = &lt;?php echo $row[price];?&gt;;
    $("select option:selected").each(function() {
                str += $(this).text() + " ";
            });
    $(".plan_price").text("price : " + parseInt(str) * price + " baht");
    Quantity = parseInt(str);
}).change();
    &lt;/script&gt;
</code></pre>

<p>and this for php/sql</p>

<pre><code>if ($row[item_amount] - 1 == 0) {
                $sql = "update item set active='2',item_amount=item_amount-1,buy_time=NOW() where id='$id'";
            } else {
                $sql = "update item set item_amount=item_amount-1,buy_time=NOW() where id='$id'";
            }
</code></pre>

<p>I want to know if there is any way for me to subtract/add the value of the javascript variable Quantity to/from the $row[item_amount] in php as I need the Quantity to be subtracted from the database.</p>

<p>Thanks in advanced </p>

<p>Tony</p>
