I need your help.,
How to pass the array values in query string...
<?php
foreach ( $Cart->getItems() as $order_code=>$quantity ) :
$pname[]= $Cart->getItemName($order_code);
$item[]= $Cart->getItemPrice($order_code);
$qty[]=$quantity;
endforeach;
?>
<form action='expresscheckout.php?amt=<?php echo $total_price; ?>&item_name=<?php echo $pname; ?>&unit=<?php echo $item; ?>&quan=<?php echo $qty; ?>' METHOD='POST'>
<input type='image' name='submit' src='https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif' border='0' align='top' alt='Check out with PayPal'/>
</form>
This is my code sample.,for the above sample code i have to pass the query string on my action url that is expresscheckout.php?amt=100.,etc...values are coming under the $pname[],$item[],$qty[].
Expecting output in expresscheckout.php
expresscheckout.php?pname=product1,product2&item=item1,item2&qty=1,2,3....like this....
Thanks in Advance....
Basically, you just need to use PHP's implode function to turn an array into a comma-separated list. i.e. for the $item array:
Will output:
So, something like this should print a querystring similar to what you want: