I currently have the following PayPal button with the values and 'item_name' and 'amount' being inserted dynamically via PHP.
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="info@example.com">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="item_name" value="<?php echo $title; ?>">
<input type="hidden" name="amount" value="<?php echo $amount; ?>">
<input type="image" src="http://www.example.com/paypal-button.gif" border="0" name="submit" alt="Click here to pay now">
</form>
Is there a way to have the same data set as a 'link' rather than a 'form'?
I am aware that you can set up PayPal buttons as links manually via their site, with fixed pricing etc, but I would like to set the price using PHP.
The purpose of this is so that the same code can be used as a link to be sent via email.
This may not be possible - any help would be appreciated.
Thanks in advance.
I think it may work something like this.
<form class="clickformsubmit" name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="info@example.com">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="item_name" value="<?php echo $title; ?>">
<input type="hidden" name="amount" value="<?php echo $amount; ?>">
<input style="display:none;" type="image" src="http://www.example.com/paypal-button.gif" border="0" name="submit" alt="Click here to pay now">
</form>
<a href="javascript:;" class="click_here">Click to send to paypal</a>
then script for this
<script type="text/javascript">
jQuery(function(){
jQuery('.click_here').click(function(){
jQuery('.clickformsubmit').submit();
});
});
</script>
You must include jQuery in header or footer for this
**Note : ** you can use $
sign instead of jQuery