adding product strings
Posted: Thu Jan 26, 2006 1:03 pm
feyd | Please use
This is the line with the problem:
It worked for awhile, and then my submit button will completely disappear (which I dont really understand how the submit button is related to this line). What I am trying to do is make a list of the products that the person is trying to buy.
Anybody know the correct way to do this? I tried multiple ways of adding strings together, but nothing seems to work - at least not consistently. At lot of ways seem to only pass the first product and then prints the rest of the products.
Thank you.
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Sorry, I am relatively new with php. I havent been able to find out how to do this anywhere. This is the section i am having trouble with:Code: Select all
if ($rowcount > 0) {
$total_cost = 0;
$total_shipping = 0;
echo "<h3> Order # $cart_id</h3><b> $row[0]</b>\n";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"6\" bgcolor=\"#000000\">\n";
echo "<tr bgcolor=\"#FFFFCE\" class=\"cart\"><td
align=\"center\"><b>Code</b></td><td><b>Item</b></td><td><b>Quantity</b></td><td><b>Unit Price</b></td><td
align=\"right\"><b>Total</b></td></tr>\n";
while ($row = mysql_fetch_array($rs)) {
echo "<tr valign=\"top\" bgcolor=\"#FFFFFF\" class=\"cart\">\n";
echo " <td align=\"center\">$row[1]</td>\n";
echo " <td> $row[2] ";
if ($row[7] <> '') {
echo "<br><b>Custom Text:</b><i> $row[7]</i>";
}
if ($row[8] <> '') {
echo "<br><b>Style:</b><i> $row[8]</i>";
}
echo "<br><b>Shipping: </b> $row[5] ". sprintf("\$%.2f", $row[6]) ."\n";
echo "</td>\n";
echo " <td align=\"middle\">$row[3]</td>\n";
echo " <td align=\"right\"> ". sprintf("\$%.2f", $row[4]) ." </td>\n";
$tc = ($row[3] * $row[4]);
echo " <td align=\"right\"> ". sprintf("\$%.2f", $tc) ." </td>\n";
echo "</tr>\n";
$total_cost += $tc;
$total_shipping += ($row[3] * $row[6]);
$invoice_num = $row[9];
*problem line $productNums = "$productNums $row[3] -> $row[1] -> $row[2], ";
}This is the line with the problem:
Code: Select all
$productNums = "$productNums $row[3] -> $row[1] -> $row[2], ";Anybody know the correct way to do this? I tried multiple ways of adding strings together, but nothing seems to work - at least not consistently. At lot of ways seem to only pass the first product and then prints the rest of the products.
Thank you.
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]