有人可以帮助我解决贝宝形式问题,一旦点击提交,需要重定向到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进行付款。请任何帮助,非常感谢! –