gpt4 book ai didi

php - paypal 获取多个 item_number

转载 作者:太空宇宙 更新时间:2023-11-03 15:47:22 24 4
gpt4 key购买 nike

我创建了一个 paypal 购物车表单,其中添加了多个产品进行付款:

        <?php
$i=1;
foreach($p_result as $prod):
?>

<div class="image">
<img src="images/<?php $result = $SimpleUsers->prod($prod['pid']); foreach($result as $row):echo $row['product_img'];?>" alt="" width="97px" height="110px"/>
</div>
<div class="name">
<?php echo $row['product'].' -- ';echo $prod['month']." mesi";?>
</div>
<div class="price">
<?php echo "N. licenze:".$prod['quantity'];?>
</div>
<div class="price">
Price: <?php echo $row['price']*$prod['month']*$prod['quantity'];?>0€
</div>

<div class="btn">
<form action='<?php echo $paypal_url; ?>' method='post' name='cart'>
<input type='hidden' name='business' value='<?php echo $paypal_id;?>'>
<input type='hidden' name='cmd' value='_cart'>
<input type="hidden" name="upload" value="1">

<input type="hidden" name="quantity_<?php echo $i; ?>" value="<?php echo $prod['quantity']; ?>">
<input type='hidden' name='item_name_<?php echo $i; ?>' value='<?php echo $row['product'];?>'>
<input type='hidden' name='item_number_<?php echo $i; ?>' value='<?php echo $prod['pid'];?>'>
<input type='hidden' name='amount_<?php echo $i; ?>' value='<?php echo $row['price']*$prod['month'];endforeach; ?>'>
<?php $i++; ?>
<input type='hidden' name='no_shipping' value='1'>
<input type='hidden' name='currency_code' value='EUR'>
<input type='hidden' name='handling' value='0'>
<input type='hidden' name='cancel_return' value='http://www.example.com/paypal/cancel.php'>
<input type='hidden' name='return' value='http://www.example.com/paypal/success.php'>

<?php

endforeach;
?>

但是在 success.php 页面上,我得到了所有变量,除了 item_number 是空的

Success.php(我获取变量的部分)

$uid = $_SESSION['uid'];
$username=$_SESSION['username'];

$item_no = $_GET['item_number'];
$item_transaction = $_GET['tx'];
$item_price = $_GET['amt'];
$item_currency = $_GET['cc'];

如何获取 item_number 变量?

最佳答案

您必须使用输入名称中的数组来获取多个值

<input type='hidden' name='item_number[]' value='<?php echo $prod['pid'];?>'>

您可以使用

获取值
print_r($_GET['item_number']) //You will get a array of item number

关于php - paypal 获取多个 item_number,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33017306/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com