Hi There -
Am a little confused trying to wrap my mind around arrays in a shopping cart. A friend from class has lent me some of her code to look at. She has a friend at work who helped her through this.
Here's the code that I understand:
while ($row=mysql_fetch_array($rs))
{
echo("<tr bgcolor=#88ccaa><td align=center>");
echo($row["prod_ID"]);
echo("</td><td>");
echo($row["prod_Name"]);
echo("</td><td>");
echo("$".$row["prod_Cost"]);
echo("</td><td>");
echo($row["prod_Unit"]);
echo("</td>");
No problem. Pretty straightforward. Populating a table with data from my database.
Here's the line I've never seen before.
<td>
Quantity <Input type="text" name="<?= $row['prod_ID'] ?>" value="<?= $_REQUEST[$row['prod_ID']] ?>" size="3">
</td>
<? } ?>
Specifically, this:
name="<?= $row['prod_ID'] ?>" value="<?= $_REQUEST[$row['prod_ID']] ?>"
First question:
Can anyone explain what the '=' means after the '<?' ??? The manual won't let me search for it.
Second question: how do I figure out how to store the arrays so that I can draw a shopping cart with the data? I'd like to store product_id, product name, quantity desired and price.
How do I get the variables to only store the data from the rows that the user chooses? The ones with an integer in the textfield.
Everything i come up with is horrendously complicated and only gets more complicated the more I think about it. I figure there's got to be an elegant and common solution to this.
Thank you to whomever helps.
Lee