[英]Paypal choose a donation and redirect to file
我有以下代碼,該代碼可讓人們選擇捐贈金額並下載文件。 目前,這允許該人輸入0並下載。 我想將最小值設為0.99。 我該如何強制捐贈,否則就不要下載。 我感謝您的幫助。
<?php
echo "<p>Donate fixed amount to CharityName</p>
<form method='POST' action=''>
<select name='currency_code'>
<option value='EUR'>EUR</option>
<option value='GBP'>GBP</option>
<option value='USD'>USD</option>
<input type='text' name='donate_amount' value='0'>
<input type='submit' name='submit' value='Donate'></form>";
if(!empty($_POST['submit'])) {
// Form has been submitted
if($_POST['donate_amount'] > 0) {
// Redirect to PayPal
header('Location: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&item_name=Donation for XXX&amount='.$_POST['donate_amount'].'¤cy_code='.$_POST['currency_code'].'&business=mypaypalemail@here.tld&cbt=Download the file&return=http://link-to-the-file&cancel_return=http://back-to-my-website');
}
else {
// No donation amount entered - proceed to file directly
header('Location: http://link-to-the-file/');
}
}
?>
查看樣本:
if(!empty($_POST['submit'])) {
if($_POST['donate_amount'] >= 0.99) {
// Redirect to PayPal
} else {
exit('Please donate at least $.99');
}
}
對於Google Analytics(分析),抱歉,我無法回答。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.