hello everyone.. i hope someone is able to help me here.
my site sells tickets for train journeys in Ukraine. it collects all the user inputs and the final price variable is passed to the final payment screen.. these variavles are passed using PHP session variables.
I have a script which collects a total price and then offers the user the option of a return ticket. the PHP session variables are converted to javascript and the final total is calculated, before the total is passed to paypal for payment. the script works fine, but i am lost as to what i need to put in the (value =””) form that is submitted to paypal.
here is my script.
[CODE]
<?php
$single = $_SESSION[‘tickets’];
$rate = $single + $_SESSION[‘services’];
?>
<script language=”javascript” type=”text/javascript”>
var test = “<?php echo $single; ?>”;
var rate = “<?php echo $rate; ?>”;
var total = rate;
function priceUpdate(tog)
{
var tCheck = tog.checked;
if (tCheck)
{
total = parseInt(rate,10) + parseInt(test,10)
}
else
{
total = rate
}
tPrice = document.getElementById(‘totalprice’);
tPrice.innerHTML = total;
}
–>
</script>
<input type=”checkbox” id=”chk1″ onClick=”priceUpdate(this)”/><b>Return Ticket</b>
<br />
<h1><b>Your Total £<span id=”totalprice”><script>document.write(total);</script></span></h1><br/>
<form action=”https://www.paypal.com/cgi-bin/webscr” method=”post”>
<input type=”hidden” name=”cmd” value=”_xclick”>
<input type=”hidden” name=”business” value=”GSMCxxxXD5TMA”>
<input type=”hidden” name=”lc” value=”GB”>
<input type=”hidden” name=”item_name” value=”Your Tickets”>
<input type=”hidden” name=”amount” value=”totalprice”>
<input type=”hidden” name=”currency_code” value=”GBP”>
<input type=”hidden” name=”button_subtype” value=”services”>
<input type=”hidden” name=”no_note” value=”1″>
<input type=”hidden” name=”no_shipping” value=”2″>
<input type=”hidden” name=”rm” value=”1″>
<input type=”hidden” name=”return” value=”http://mysite/returnpage”>
<input type=”hidden” name=”bn” value=”PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest”>
<input type=”image” src=”https://www.paypal.com/en_US/GB/i/btn/btn_buynowCC_LG.gif” border=”0″ name=”submit” alt=”PayPal – The safer, easier way to pay online.”>
<img alt=”” border=”0″ src=”https://www.paypal.com/en_GB/i/scr/pixel.gif” width=”1″ height=”1″>
</script>
</form>
this line is what will not work
[CODE]<input type=”hidden” name=”amount” value=”totalprice”>
does anyone have any ideas ??
thanks for looking