Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/248.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP Paypal动态传递多个项目_Php_Paypal - Fatal编程技术网

PHP Paypal动态传递多个项目

PHP Paypal动态传递多个项目,php,paypal,Php,Paypal,我正在尝试添加多个产品在贝宝上处理。 订单摘要没有显示任何项目。我正在贝宝沙盒上试用 以下是完整的代码: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="paypal"> <input type="hidden" name="cmd" value="_xclick" /> <input type="hidden" name="upload" v

我正在尝试添加多个产品在贝宝上处理。 订单摘要没有显示任何项目。我正在贝宝沙盒上试用

以下是完整的代码:

    <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="paypal">

 <input type="hidden" name="cmd" value="_xclick" />
 <input type="hidden" name="upload" value="1">
 <input type="hidden" name="cbt" value="Return to max shop" />
 <input type="hidden" name="business" value="example@gmail.com">

<?php
if(isset($_SESSION['products']))
{
    $obj=new project;
    $i=1;
    foreach($_SESSION['products'] as $product)
    {
        $sql=$obj->get_products($product['id']);
        $row=mysql_fetch_array($sql);
        ?>
        <input type="hidden" name="item_number_<?php echo $i ?>" value="<?php echo $i ?>">
        <input type="hidden" name="item_name_<?php echo $i ?>" value="<?php echo $row['title'] ?>" />

        <input type="hidden" name="amount_<?php echo $i ?>" value="<?php echo $row['cost'] ?>">
        <input type="hidden" name="item_quantity_<?php echo $i ?>" value="<?php echo $product['qty'] ?>">

        <?php
        $i++;
    }
}
?>


 <input type="hidden" name="button_subtype" value="services" />
 <input type="hidden" name="no_shipping" value="1" />
 <input type="hidden" name="return" value="http://localhost/oops" />

<input type="hidden" name="currency_code" value="USD"/>

<input type="hidden" id="custom" name="custom" value="invoice_id to track"/>
 <input type="hidden" class="btn btn-primary" style="width:100%" alt="PayPal - The safer, easier way to pay online!"/>
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" width="68" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
</form>


上载命令仅适用于
\u购物车
,而不适用于
\u xclick

将此行更改为:

 <input type="hidden" name="cmd" value="_cart" />

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="paypal">

 <input type="hidden" name="cmd" value="_cart" />
 <input type="hidden" name="upload" value="1">
 <input type="hidden" name="cbt" value="Return to max shop" />
 <input type="hidden" name="business" value="XXX-facilitator@gmail.com">

<?php
$_SESSION['products'] =2;
$product ='';
$pro =array("red","green"); 
if(isset($_SESSION['products']))
{
    // $obj=new project;
    $i=1;
    foreach($pro as $key)
    {
        //$sql=$obj->get_products($product['id']);
        $row='row';
        ?>
        <input type="hidden" name="item_number_<?php echo $i ?>" value="<?php echo $i ?>">
        <input type="hidden" name="item_name_<?php echo $i ?>" value="title" />

        <input type="hidden" name="amount_<?php echo $i ?>" value="10.00">
        <input type="hidden" name="item_quantity_<?php echo $i ?>" value="product">

        <?php
        $i++;
    }
}
?>


 <input type="hidden" name="button_subtype" value="services" />
 <input type="hidden" name="no_shipping" value="1" />
 <input type="hidden" name="return" value="http://localhost/oops" />

<input type="hidden" name="currency_code" value="USD"/>

<input type="hidden" id="custom" name="custom" value="invoice_id to track"/>
 <input type="hidden" class="btn btn-primary" style="width:100%" alt="PayPal - The safer, easier way to pay online!"/>
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" width="68" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
</form>


我也试过了,但它显示了一个错误:“我们检测到这个购物车有问题。如果问题仍然存在,请联系商家。”你能发布由PHP代码生成的html代码吗?从不能重新发布整个HTML,它太长了,顺便说一句,它和我上面发布的一样。
 <input type="hidden" name="cmd" value="_cart" />

<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="paypal">

 <input type="hidden" name="cmd" value="_cart" />
 <input type="hidden" name="upload" value="1">
 <input type="hidden" name="cbt" value="Return to max shop" />
 <input type="hidden" name="business" value="XXX-facilitator@gmail.com">

<?php
$_SESSION['products'] =2;
$product ='';
$pro =array("red","green"); 
if(isset($_SESSION['products']))
{
    // $obj=new project;
    $i=1;
    foreach($pro as $key)
    {
        //$sql=$obj->get_products($product['id']);
        $row='row';
        ?>
        <input type="hidden" name="item_number_<?php echo $i ?>" value="<?php echo $i ?>">
        <input type="hidden" name="item_name_<?php echo $i ?>" value="title" />

        <input type="hidden" name="amount_<?php echo $i ?>" value="10.00">
        <input type="hidden" name="item_quantity_<?php echo $i ?>" value="product">

        <?php
        $i++;
    }
}
?>


 <input type="hidden" name="button_subtype" value="services" />
 <input type="hidden" name="no_shipping" value="1" />
 <input type="hidden" name="return" value="http://localhost/oops" />

<input type="hidden" name="currency_code" value="USD"/>

<input type="hidden" id="custom" name="custom" value="invoice_id to track"/>
 <input type="hidden" class="btn btn-primary" style="width:100%" alt="PayPal - The safer, easier way to pay online!"/>
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" width="68" height="23" alt="Make payments with PayPal - it's fast, free and secure!">
</form>