shrocks
asked on
Storing data from an array to a session
Ok, heres my question. i have a array thats calling my data from a mysql database and displaying it in a table
i want to make it so each new row in the table is a seperate form, and when add to cart is clicked the data from that row is added to a session, can anyone let me know the easiest way to do this
while ($row= mysql_fetch_array ($result, MYSQL_ASSOC)){
print "<tr bgcolor=\"#666666\">";
print "<td>
<form method=\"post\" action=\"punk.php\">
$row[ProductID]
</td>";
print "<td>$row[ProductArtist]</ td>";
print "<td>$row[ProductName]</td >";
print "<td>$row[ProductType]</td >";
print "<td>$row[ProductDescripti on]</td>";
print "<td><img src=\"$row[ProductImage]\" ></td>";
print "<td>$$row[ProductCost]</t d>";
print "<td>
<input type=\"submit\" name=\"addtocart\" value=\"Add To Cart\">
</form>
</td>";
print "</tr>";
}
print "</table>";
}
thats the end of my array and table, how can i make it so that data from the add to cart button is on is stored in a session to be displayed on another page.
any help is greatly appreciated
thx
i want to make it so each new row in the table is a seperate form, and when add to cart is clicked the data from that row is added to a session, can anyone let me know the easiest way to do this
while ($row= mysql_fetch_array ($result, MYSQL_ASSOC)){
print "<tr bgcolor=\"#666666\">";
print "<td>
<form method=\"post\" action=\"punk.php\">
$row[ProductID]
</td>";
print "<td>$row[ProductArtist]</
print "<td>$row[ProductName]</td
print "<td>$row[ProductType]</td
print "<td>$row[ProductDescripti
print "<td><img src=\"$row[ProductImage]\"
print "<td>$$row[ProductCost]</t
print "<td>
<input type=\"submit\" name=\"addtocart\" value=\"Add To Cart\">
</form>
</td>";
print "</tr>";
}
print "</table>";
}
thats the end of my array and table, how can i make it so that data from the add to cart button is on is stored in a session to be displayed on another page.
any help is greatly appreciated
thx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for you answer, thats exactly what i was looking for, thank you
you are welcome and thanks for the points. :=)
should better read:
Assign the row values as hidden variables inside the form.