Page 1 of 1

problem sending JS value to PHP

Posted: Sun Nov 22, 2009 7:59 am
by eshban
Hi,

I need to send js value to php, but i am having some problem in it.
here is my website url

Code: Select all

http://www.shehzads.com/Projects/flu/try.html
Just change quantity and you will see updated price.

I want that when user click on checkout button then i need the values of "Quantity" and Price at my php page.

please help

thnaks

Re: problem sending JS value to PHP

Posted: Sun Nov 22, 2009 9:05 am
by BlaineSch
Don't put the final price in the GET that can be too easily modified just put quantity. Either update the link or update a hidden input field.

Just update your "updatePrice()" function in your script.

Code: Select all

<script>
function updatePrice() {
    var userInput = document.getElementById('price').value; 
    document.getElementById('q1q1').value=userInput;
}
</script>
<input type="hidden" name="quantity" value="0" id="q1q1">