HELP with paypal order form!! for all you experts!
(Sorry if in wrong thread)
Hey PHP/PayPal experts. I really need your help with this one! I have tried everything and eliminated most of my problems.
I want to create a form that allows the customer to customize their order. This customization is then passed to PayPal (so I know what they want). I have done this part. The part I need help with is passing the updated total to PayPal. I have tried everything but can’t get it to pass the UPDATED total. It will pass the default total (£99) but when you customize the order and the total increases to say £150, this won’t be passed to PayPal and PayPal will only show £99. I’m 95% sure this is a simple fix for someone who knows what they’re doing, Please help!
(sorry for basic design but once i get this working, I can customize it)
My code is as follows...
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>PSD to HTML Order Form</title>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">google.load("jquery", "1")</script>
<script>// JavaScript Document
$(document).ready(function()
{
var total = 0;
function calcTotal()
{
$("input:checked").each(function()
{
//This happens for each checked input field
var value = $(this).attr("value");
total += parseInt(value);
});
}
//This happens when the page loads
calcTotal();
$("form").before('<p class="total">Total £ <strong>' + total + '</strong></p>');
$(":submit").before('<p class="total">Total £ <strong>' + total + '</strong></p>');
$("input:checkbox, input:radio").click(function()
{
total = 0;
calcTotal();
$("p.total").html("Total £ <strong>" + total + "</strong>");
});
document.getElementById("finalpaypal").value = total;
});
</script>
<link rel="stylesheet" href="css/form.css" type="text/css" media="screen" >
</head>
<body>
<div id="wrapper">
<h1>PSD to HTML Service</h1>
<p>Choose your from the packages and services below</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" id="payPalForm">
<input type="hidden" name="item_number" value="Product Name">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="business" value="email">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="return" value="complete.php">
<input type="hidden" name="item_name" value="Item Name">
<input type="hidden" name="on3" value="Size">
<input type="radio" name="os3" value="Small"> Small
<input type="radio" name="os3" value="Medium"> Medium
<input type="radio" name="os3" value="Large"> Large
<fieldset id="packages">
<legend>Packages</legend>
<ol>
<li>
<input type="radio" name="package" id="package_basic" value="99" checked />
<label for="package_basic">Basic: This package is aight. ($99)</label>
</li>
<li>
<input type="radio" name="package" id="package_pro" value="149" />
<label for="package_pro">Professional: This package straight rocks. ($149)</label>
</li>
</ol>
</fieldset>
<fieldset id="delivery_speed">
<legend>Delivery Speed</legend>
<ol>
<li>
<input type="radio" name="speed" id="speed_1day" value="49" />
<label for="speed_1day">1 day ($49)</label>
</li>
<li>
<input type="radio" name="speed" id="speed_3days" value="0" checked />
<label for="speed_3days">3 days (no charge)</label>
</li>
<li>
<input type="radio" name="speed" id="speed_5days" value="-39" />
<label for="speed_5days">5 days ($39)</label>
</li>
</ol>
</fieldset>
<fieldset id="browser_support">
<legend>Browser Support</legend>
<p>
<input type="checkbox" name="browser" id="browser" value="100" />
<label for="browser">Will work in IE 12 ($100)</label>
</p>
</fieldset>
<input type="hidden" name="amount" id="finalpaypal">
<p><input id="submit" type="submit" value="Submit"></p>
</form>
</div>
</body>
</html>