At the moment I am using 3 different pages which are HTML, JavaScript and PHP. I already made the input and I can calculate price
* quantity
using the JavaScript.
But I have this problem: how can I send the calculated value to a PHP page?
HTML:
number of people:<input id="quantity" name="quantity" size='5'></input>
<br>
<br>
Price:<input type='hidden' id='price' name='price' value='755'></input>
<button type="button" onclick="sum()">calculate</button>
<p id='result' name='result'></p>
JS:
function sum() {
var quantity = parseInt(document.getElementById('quantity').value);
var price = parseInt(document.getElementById('price').value);
var total = price * quantity;
document.getElementById('result').innerHTML = total;
document.getElementById('result').value = total;
}
PHP:
<?php
$total = $_POST['result'];
echo "price :".$total."<br/>";
?>
I can not get the value. Please help. Thanks.