I need to paste this code at admin panel and then display Paypal Button on website.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="6UKjJ8hU6ML5f">
<input type="hidden" name="custom" value="<?php print($_SESSION['mid'].'-'.$_SESSION['mps']);?>">
<input type="image" src="https://www.sandbox.paypal.com/en_US/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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Then, need to display this code on website using following code.
print $rs->fields("ppbutton");
Now, problem is that due to PHP code inside Paypal form, whenever I try to print above value (paypal button) on website, it's giving error because of PHP code inside another PHP code.
I also think, print htmlentities($rs->fields("ppbutton"));
is the best option for you.
You can get the most recent updates about the function from this site.
http://php.net/manual/en/function.htmlentities.php
print htmlentities($rs->fields("ppbutton"));
Related
I'm trying to add a donation page with paypal integration. It works perfectly fine. But what I want to add is to first sign the form from my site and then send it to paypal as well as the selected amount of donation. I've also trid to put this code <input type="hidden" name="amount" value="<?php echo $total; ?>"> as per my research. But it's still not working. Please see my code below for your review/reference.
Code
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="QWEVB36VTJYEG">
<input type="hidden" name="amount" value="88.00">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
The result would be just like this: (Blank Value) (The value must be 88.00)
As far as I know, donations on Paypal can't be restricted to one single value. The amount input is ignored, to be sure that people who will donate are not being manipulated and forced to pay a price they did not choose.
However, if you want to propose some fixed prices, here is a Paypal Community code which will help you doing that.
EDIT: Here is a StackOverflow answer which is pretty clear and confirms my thoughts.
Hy guys, How to make button paypal with our variable $total, I make button paypal automatic in paypal.com, but I don't know how to change code with my variable total in my program, and change this value with my email <input type="hidden" name="hosted_button_id" value="6GRSJ868MQYPS">
this is my code can any solution with my problem ?
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="6GRSJ868MQYPS">
<input type="image" src="https://www.paypalobjects.com/en_US/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.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Hosted buttons hide those parameters, so you won't be able to dynamically adjust the $total when the page loads. If you want to do that you'll need to create a button that is not hosted, and then you would have an "amount" parameter you could pass your $total into.
I am certainly interested in using PayPal's Standard payment buttons; however, I would like to be able to set the amount myself in code, instead of being forced to create a button with a fixed amount through Paypal. For example, I thought the following code would work:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="amount" value="5.00">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIH2wYJKoZIhvcNAQcEoIIHzDCCB8gCAQExggE6MIIBNgIBADCBnjCBmDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExETAPBgNVBAcTCFNhbiBKb3NlMRUwEwYDVQQKEwxQYXlQYWwsIEluYy4xFjAUBgNVBAsUDXNhbmRib3hfY2VydHMxFDASBgNVBAMUC3NhbmRib3hfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tAgEAMA0GCSqGSIb3DQEBAQUABIGAH+DqNBRlDwSh687j3TxNmxEdl5QzHnS7yVrZpgBots7qg9fODfjYUlgXXMPz35gB65jiD+jsCd1dc3yVZ5mNRtMu8uyLkKO4APlg4qJZETM5zmtoMeom4AMXCm+1hagsWjMEE3o5oUGyjEkFwz+pflNqviUoEQwdCv2O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spSK1HPgmDyeDmKy355dX83/42P04b/faGikPPaBHSvEsoL4MmMSj/Jqfzg1iV8tbynyf/VT9DlitZlho54CygGaT/ZcML6M/JRJlECWzsnc0=-----END PKCS7-----
">
<input type="image" src="https://www.sandbox.paypal.com/en_US/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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
This does not work either:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="U7K937HLYPW6L">
<input type="hidden" name="amount" value="5.00">
<input type="image" src="https://www.sandbox.paypal.com/en_US/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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Instead of directing the user to a page where they could make a payment of 5.00, the page instead allows users to input their own amount. In my real application, I would use PHP to calculate the total (at a cart style page) and associate that value with the 'amount' key, but I cannot even get it to work even with static values. What is the solution?
Thanks much!
You would need to utilise their API to produce dynamic pricing to break away from the "cart" type system provided by paypal. Essentially you would look to replace the paypal "cart" page with your own by coding using the API.
I've recently redesigned a site I'd originally built 2/3 years back. We used PayPal buttons for Gift Vouchers and Deposits, but neither are working on the new version.
One of the pages affected is http://www.louiseballantine.com/giftvouchers.php - you'll see that the buttons display properly, but nothing happens when clicked.
However, the old version of the page (and I've added the same code for the new button) works perfectly: http://www.louiseballantine.com/giftvouchers_old.php
Here is the code for the first button (copied and pasted from PayPal):
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="497ZF2RU65YJQ">
<input type="image" src="http://www.louiseballantine.com/img/voucher05.png" border="0" width="100%" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
As I said previously, there's also an issue with the contact forms, so this may not be a specific problem with the PayPal code. However, any assistance would be gratefully received.
Thank you.
Problem solved by removing bootstrap's integrated form-handling scripts.
I am developing a PHP site, and have encountered the following problem.
I have this line of code:
<div id="buynow"><?php echo $buynow; ?></div>
The variable $buynow has an html code (a paypal buy now button), and I would like to print/echo the html code that it gets processed.
With the current code, it prints the html code itself, not the desired result.
Thanks in advance
String:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="XXXXXXXXXXXX">
<table>
<tr><td><input type="hidden" name="on0" value="Colors">Colors</td></tr><tr><td><select name="os0">
<option value="Black">Black </option>
<option value="White">White </option>
</select> </td></tr>
</table>
<input type="image" src="https://www.paypalobjects.com/en_US/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.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Note: The value is replaced to XXXXXXXXX on purpose, in the code it is the original.
maybe try this:
<div id="buynow"><?php echo htmlspecialchars_decode($buynow); ?></div>
or use
<div id="buynow"><?php echo html_entity_decode($buynow); ?></div>
The method I use on simple Paypal button sites is to save the button code as little php files on their own (can just be the html making up the Paypal button). Then "include" the external file at the relevant point. It makes managing the buttons relatively easy without changing your source code.
Other than that, it seems that your page may not actually be a php page.