title: Want to connect my shopping cart total price to a paypal checkout
body: <p>I have a <code>displaycart.php</code> page where it displays all items I have in a shopping cart, each item has an <code>ItemUnitPrice</code> field where it shows the unit price of the item.</p>
  
  <p>If I have say 6 items in the cart then I want to add up the total <code>ItemUnitPrice</code> fields and set that amount to be paid with PayPal.</p>
  
  <p>I have checked out PayPals button features which they allow and you can only set a given price for the user to pay for when you create the button.</p>
  
  <p>Is there a way I can link the PayPal button to my database so it shows the total of all the <code>ItemUnitPrice</code> fields.</p>
  
  <p>The variable which holds the total <code>ItemUnitPrice</code>:</p>
  
  <pre><code>&lt;?php
  $Total = $Quantity * $ItemUnitPrice;
  ?&gt;
  </code></pre>
  
  <p>The PayPal 'Pay Now' Button:</p>
  
  <pre><code>&lt;html&gt;
  &lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"&gt;
  &lt;input type="hidden" name="cmd" value="_s-xclick"&gt;
  &lt;input type="hidden" name="hosted_button_id" value="KAMQ5PVWVDYYN"&gt;
  &lt;input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_paynow_LG.gif"    border="0" name="submit" alt="PayPal – The safer, easier way to pay online."&gt;
  &lt;img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif"  width="1" height="1"&gt;
  &lt;/form&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>Yeah I've done something stupidly wrong!</p>
  
  <pre><code>&lt;form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_BLANK"&gt;
  &lt;input type="hidden" name="cmd" value="_xclick" /&gt;
  &lt;input type="hidden" name="business" value="info@asianweddingservices.org" /&gt;
  &lt;input type="hidden" name="item_name" value="&lt;? $ItemDesc ?&gt;" /&gt;
  &lt;input type="hidden" name="item_number" value="&lt;?$ItemCode ?&gt;" /&gt;
  &lt;input type="hidden" name="amount" value="&lt;?$Total ?&gt;" /&gt;
  &lt;input type="hidden" name="currency_code" value="GBP" /&gt;
  &lt;input type="hidden" name="lc" value="GB" /&gt;
  &lt;input type="hidden" name="bn" value="PP-BuyNowBF" /&gt;
  &lt;input src="paypal/purchase.png" name="Submit" type="image" value="purchase" alt="Purchase" /&gt;
  &lt;/form&gt;
  </code></pre>