I have created an order form where new products can be added etc but I have bumped into a problem which I cannot seem to solve. When a new item is added to the database and the user selects it as a product for their cart, it is read as hidden fields on each form, just so the script can detect exactly which products have been selected. Now, on the finalconfirmation page which querys the customer details into the database I can not seem to detect new products which have been added. It is very confusing to explain this but im sure it can be worked out. I tried making a loop but instead of showing the products it shows the first product, "CD-Player" in every column. I thought it would have done that seen as the structure of the loop, nevertheless any help appreciated here.
Code: Select all
$sql1 = "SELECT * FROM dbproducts";
$result = mysql_query($sql1) or die(mysql_error());
while (true)
{
$row = mysql_fetch_assoc($result);
if ($row == false) break;
$val = $row['product'];
$val1 = str_replace(" ","-",$val);
$i=0;
do
{
$i++;
$value[$i] = $_POST[$val1];
}
while($i<9);
$nextsql = "INSERT INTO dborderdetails VALUES('$fullname','$value[1]','$value[2]','$value[3]','$value[4]','$value[5]','$value[6]','$value[7]','$value[8]','$value[9]')";
mysql_query($nextsql) or die(mysql_error());
}