problem sending JS value to PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

problem sending JS value to PHP

Post 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
User avatar
BlaineSch
Forum Commoner
Posts: 28
Joined: Sun Jun 07, 2009 4:28 pm
Location: Trapped in my own little world.

Re: problem sending JS value to PHP

Post 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">
Post Reply