我有这些文件是通过PayPal以根据用户选择的dinamic价格开始交易。
<script language="javascript">
submitForms = function(){
document.getElementById("paypal2_form").submit();
document.getElementById("paypal_form").submit();
}
</script>
<form class="paypal" action="payments.php" method="post" id="paypal2_form" target="_blank">
<input type="text" name="amount" value=""/>
<input type="button" value="Click Me!" onclick="submitForms()" />
</form>
<form class="paypal" action="payments.php" method="post" id="paypal_form" target="_blank">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="lc" value="UK" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynow_LG.gif:NonHostedGuest" />
<input type="hidden" name="first_name" value="Customer's First Name" />
<input type="hidden" name="last_name" value="Customer's Last Name" />
<input type="hidden" name="payer_email" value="customer@example.com" />
<input type="hidden" name="item_number" value="123456" / >
</form>
这是php
// Database variables
$host = "localhost"; //database location
$user = "root"; //database username
$pass = ""; //database password
$db_name = "payments"; //database name
$paypal_email = 'myemail';
$return_url = 'return page.org';
$cancel_url = 'cancel page.org';
$notify_url = 'notify page.org';
$xd = $_POST['amount'];
$item_name = 'Test Item';
$item_amount = 10;
...
问题是$ item_aamount,如果我把确切的值它会起作用,但如果我使用来自表单的值的变量,它会在paypal窗口上询问插入值。我在html上试了页面插入数据库上的值,并在这个PHP上请求它,但我不知道该怎么把transaction_id,字段我不知道它来自哪里。
(在html页面上我有一个脚本,提交2个表单,其中一个值与paypal的东西一起,它是一个文本输入,因为它是一个测试,使paypal从变量中获取该混蛋值。)