Len Whistler
10-15-2005, 12:26 AM
The javascript code below adds values "sh" and "ww" for the text box named "shipping" and updates instantly when the user selects the location to ship to.
document.autoSumForm.shipping.value = (sh * 1) + (ww * 1);
I would like to pass that value on to a PHP variable. Can this be done?
Thanks
pccode
10-15-2005, 02:08 AM
You would need to either submit the form to a php script:
<form action="yourpage.php">
or redirect to a php script using something like this:
window.open("yourpage.php?shipping="document.autoSumForm.shipping.value,"newWindow");
Then in your php script use:
$input = $_REQUEST['shipping'];
The input variable would then contain the shipping value from your form.
Len Whistler
10-15-2005, 06:49 AM
Ok thanks pccode....
I got it to work with code #1 and #3. And I will look into code #2 later on. I'm building a PHP, MySQL and Javascript shopping cart from scratch.
Pyth007
10-18-2005, 11:57 PM
You could also store your calculated value as a 'hidden' type of input field and have it get passed along as a $_POST[] value...