我有以下代码,允许该人选择捐赠金额并下载文件。目前,这允许该人输入 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/');
}
}
?>