I’ve a big problem:
When someone selects multiple products, for example he selects 3 products, it goes into the shopping cart. When he sends the order (checkout) I only see the first product in my mail, not 3.
This is because I have stated in function.js:
function fillInForm(){
NumberOrdered = 0;
NumberOrdered = readCookies("NumberOrdered");
for (i = 1; i <= NumberOrdered; i++){
NewOrder = "Order" + i;
thisCookie = "";
thisCookie = readCookies(NewOrder);;
fields = new Array();
fields = thisCookie.split("|");
document.write("<input type=hidden name=\"Product ID " + i + "\" value=\"" + fields[0] + "\">");
document.write("<input type=hidden name=\"Brand " + i + "\" value=\"" + fields[1] + "\">");
document.write("<input type=hidden name=\"Model " + i + "\" value=\"" + fields[2] + "\">");
document.write("<input type=hidden name=\"Price " + i + "\" value=\"" + fields[3] + "\">");
document.write("<input type=hidden name=\"Amount products " + i + "\" value=\"" + fields[4] + "\">");
document.write("<input type=hidden name=\"Total cost " + i + "\" value=\"" + fields[3] * fields[4] + "\">");
document.write("<input type=hidden name=\" " + "\" value=\"" + "\">");
}
}
when I use var_dump($_GET); it shows me everything, so the three products it shows me have
something like
["Brand_1"]=>
["Brand_2"]=>
["Brand_3"]=>
In mail.php where the information is send to I have:
$brand = $_GET["Brand_1"]; (<<WITH 1, one)
because
$brand = $_GET["Brand_i"]; (<<WITH i) does not work.
But in theory I need
$brand = $_GET["Brand_i"] (<<WITH i)to get all the products............
How can I fix this?
mail.php
$productid = $_GET["Product_ID_1"];
$brand = $_GET["Brand_1"];
$model = $_GET["Model_1"];
$price = $_GET["Price_1"];
$amount = $_GET["Amount_products_1"];
$totalcost = $_GET["Total_cost_1"];
$message .= 'Your order information: ' . '<br />';
$message .= 'Product ID: ' . $productid . "<br />" .
'Brand: '. $brand . "<br />" .
'Model: ' . $model . "<br />" .
'Price per item: ' . $price . "<br />" .
'Amount of item: ' . $amount . "<br />" .
'Total cost: ' . $totalcost . "<br />" .
'Order date and time: ' . $date;
$message .= '</body></html>';
1 Answer