I have a page called subscriptions.php in which a while loop generates products and prices from the Database for a given product category. The relevant code for this is:
<?php
$result = mysql_query( "SELECT * FROM Subscriptions WHERE Prod_cat='N'", $db);
if (!$result) {
echo("<p>Error performing query: " . mysql_error() . "</p>");
exit();
}
?>
<form name="myform" method="post" action="subform1.php">
<?php
while ( $myrow = mysql_fetch_array($result) ) {
echo ("<table><tr><td>" . $myrow["Prod_name"] . "</td><td>" . $myrow $myrow1["Price"] . "</td><td>input type='checkbox' name='checkproduct' value='$myrow[Product_id]'></td></tr></table>") ;
}
?>
</form>
In subform1.php, I want to view all the products checked and then calculate the total price for these products. However, I am having trouble retrieving the values of the products checked, as all the checkboxes generated in the while loop will have the same name of "checkproduct".
Any ideas what I should do?
Thanks