Hi, I am using a prototype PayPal payment system which does not ever need to properly work, but I am having trouble writing to the database as well as redirecting to the PayPal payment page at the same time.
Here is the form:
echo '<form name="purchase" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';
echo '<input type="hidden" name="cmd" value="_xclick">';
echo '<input type="hidden" name="business" value="*********">';
echo '<input type="hidden" name="lc" value="GB">';
echo '<input type="hidden" name="item_name" value="' . $name . '">';
echo '<input type="hidden" name="amount" value="' . $price . '">';
echo '<input type="hidden" name="currency_code" value="GBP">';
echo '<input type="hidden" name="button_subtype" value="services">';
echo '<input type="hidden" name="no_note" value="0">';
echo '<input type="hidden" name="shipping" value="' . $postage . '">';
echo '<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">';
echo '<input type="image" src="https://www.paypal.com/en_US/GB/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online." onClick="return confirmSubmit()">';
echo '<img alt="" border="0" src="https://www.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">';
echo '</form>';
This is the code that is auto generated from PayPal, this takes a few variables and uses them when the 'BUY' button is clicked, As you can see when the button is clicked it goes to 'https://www.paypal.com/cgi-bin/webscr' through the form action.
This is working fine and does not need to change, what I am having trouble doing is also linking to another php page when the form is submitted so that I can write some data to the database to record the purchase.
I hope someone can help.
Thanks.