title: Calculate the value using JavaScript and send to PHP
body: <p>At the moment I am using 3 different pages which are HTML, JavaScript and PHP. I already made the input and I can calculate <code>price</code> * <code>quantity</code> using the JavaScript.</p>
  
  <p>But I have this problem: how can I send the calculated value to a PHP page?</p>
  
  <p>HTML:</p>
  
  <pre><code>number of people:&lt;input id="quantity" name="quantity" size='5'&gt;&lt;/input&gt;
  &lt;br&gt;
  &lt;br&gt;
  Price:&lt;input type='hidden' id='price' name='price' value='755'&gt;&lt;/input&gt;
  &lt;button type="button" onclick="sum()"&gt;calculate&lt;/button&gt;
  &lt;p id='result' name='result'&gt;&lt;/p&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>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;
  }
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php
    $total = $_POST['result'];
  
    echo "price :".$total."&lt;br/&gt;";
  ?&gt;
  </code></pre>
  
  <p>I can not get the value. Please help. Thanks.</p>