Greeting phphelp forum users ;
so lately i was making shopping website from scratch using php as my developing language … everything is working nice until this days i notice that when i go to Paypal to checkout Paypal only get one product name , and one product id but its get the total amount of money and everything else … so my problem is that i need to fix it,making Paypal able to detect all the product name and id in the cart and not only once … i know i need a loop somewhere but when i made one it didn’t work , so i really hope you guys can help me , also this is not real website for shopping is just school projet … thanks guys
here is my code until now :
<div>
<?php
include ("includes/cx.php");
$total =0;
global $con;
$ip = getIp();
$sel_price ="select * from cart where ip_add = '$ip'";
$run_price = mysqli_query($con, $sel_price);
while($p_price = mysqli_fetch_array($run_price)) {
$pro_id = $p_price['p_id'];
$pro_price = "select * from products where product_id='$pro_id'";
$run_pro_price = mysqli_query($con, $pro_price);
while ($pp_price = mysqli_fetch_array($run_pro_price)) {
$product_price = array($pp_price['product_price']);
$product_name=$pp_price['product_title'];
$values = array_sum($product_price);
$total += $values;
}
}
?>
<h1 align="center" style="font-size: large;margin: 5px">Pay Now with Paypal :</h1>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<!-- Identify your business so that you can collect the payments. -->
<input type="hidden" name="business" value="[email protected]">
<!-- Specify a Buy Now button. -->
<input type="hidden" name="cmd" value="_xclick">
<!-- Specify details about the item that buyers will purchase. -->
<input type="hidden" name="item_name" value="<?php echo $product_name; ?>">
<input type="hidden" name="item_number" value="<?php echo $pro_id; ?>">
<input type="hidden" name="amount" value="<?php echo $total?>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="return" value="http://pfe2016.livehost.fr/paypal_success.php"/>
<input type="hidden" name="cancel_return" value="http://pfe2016.livehost.fr/paypal_cancel.php"/>
<!-- Display the payment button. -->
<input type="image" name="submit" border="0"
src="images/paypal-logo.png"
alt="PayPal - The safer, easier way to pay online">
<img alt="" border="0" width="1" height="1"
src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" >
</form>
</div>
-*--------------------
thanks again guys … waiting for some solutions