I am trying to make a PayPal form where if the user enters an amount they get sent to the paypal payment page and if they don't enter an amount but click submit they go to another page. I get the header to redirect fine when I add yahoo or google as the destinations but when I add the paypal link it sends me to their home page instead of the payment page. Can someone check my code and see if I'm missing something? Thanks
HTML Code:
<form action=" <?php if(!empty($_POST['submit']))
{ if($_POST['amount'] > 0) {
header("Location: https://www.paypal.com/cgi-bin/webscr");exit;
} else {
header("Location: http://www.google.com/");exit;
}
} ?>" method="post">
<input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="business" value="test@email.com">
<input type="hidden" name="item_name" value="Donation"><input type="hidden" name="item_number" value="1">
$ <input type="text" name="amount">
<input type="hidden" name="no_shipping" value="0"><input type="hidden" name="no_note" value="1"><input type="hidden" name="currency_code" value="USD"><input type="hidden" name="lc" value="AU"><input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="return" value="http://www.yahoo.com" />
<input type="submit" name="submit" value="Donate"><img alt="" border="0" src="https://www.paypal.com/en_AU/i/scr/pixel.gif" width="1" height="1"></form>
I also have ob_start and ob_end_flush at the beginning and end of my test page, with nothing else on the page.
Bookmarks