有人可以幫助我解決貝寶形式問題,一旦點擊提交,需要重定向到paypal.php,然後去貝寶網站付款。問題在於,在執行此操作時,paypel網站中的付款金額爲空,未顯示產品名稱和價格。貝寶IPN - 打開貝寶網站前的重定向頁面
預先感謝您!
的index.php
<?
$products = $mysqli->query("SELECT * FROM `product` WHERE `id` > '0' ORDER BY `price` ASC");
for($j=1; $product = $products->fetch_assoc(); $j++){
?> \t \t \t \t \t \t \t
<?
\t if(isset($_POST['submit'])){
\t \t \t redirect_to('functions/paypal/paypal.php');
\t \t }
?>
\t \t <form method="post">
\t <tr style="border-bottom:1px solid #f2f3f6;">
\t <td><?=$product['name'];?></td>
<td><?=$product['price'];?></td>
<td><input type="submit" value="Buy" name="submit" /></td>
</tr>
\t \t </form>
<?}?>
paypal.php形成
<?
require('functions/db.php');
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>redirect to paypal service..</title>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<script type="text/javascript">
\t setTimeout('document.formpaypal.submit()',1000);
</script>
</head>
<body>
<form name="formpaypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?=$sites['paypal']?>">
<input type="hidden" name="item_name" value="<?=$product['name'];?>">
<input type="hidden" name="custom" value="<?=$data['id'];?>">
<input type="hidden" name="amount" value="<?=$product['price'];?>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="index.php?success">
<input type="hidden" name="cancel_return" value="index.php?cancel">
<input type="hidden" name="notify_url" value="funtions/paypal/ipn.php">
</form>
</body>
</html>
您是否試圖將index.php中的數據添加到paypal.php頁面? –
@BlakeConnally - 是的,我想在index.php中展示產品,當買家點擊提交時,他們重定向到paypal.php以獲取表單輸入,然後重定向到paypal.com進行付款。請任何幫助,非常感謝! –