Jump to content

[SOLVED] Check boxes within a while loop


Navajo

Recommended Posts

Ok, I'm a newbie at PHP and I need some help off an expert please, I can't think of how I would do this.

 

I have a table with 7 columns, the first column contains the ProductID code and the 7th column contains a checkbox, all generated through a while loop on the results of the database.

 

How can I get this so that when I tick for example two checkboxes, the productcodes that they relate to are passed to a new php script called editLimit.php.

 

I'm really stuck guys and girls :(

 

Can someone please help me!?

 

thanks for any help in advance.

 

<center><table border=1>
<tr align=left valign=top>
<td><h3><center> Product ID </center></h3></td>
<td><h3><center>Product Description</center></h3></td>
<td><h3><center> Assesment Limit </center></h3></td>
<td><h3><center>  Update Avaliable </center></h3></td>
<td><h3><center>Delete</center></h3></td>
<td><h3><center>Edit</center></h3></td>
<td><h3><center>Select</center></h3></td>
</tr>


<?php
while ($row = mysql_fetch_array($result)) {
extract($row);
$productID = $row['vchar_product_id'];
$description = $row['vchar_description'];
$assLimit = $row['vchar_assessment_limit'];
$updateAv = $row['i_update_available'];

echo "<tr>\n<td align=center>$productID</td>\n";
echo "\n<td align=center>$description</td>\n";
echo "\n<td align=center>$assLimit</td>\n";
echo "\n<td align=center>$updateAv</td>\n";

echo "<td align=center><form name=\"passDelete\" method=\"post\" action=\"passDelete.php?id=$productID\"><input type=\"hidden\" name=\"prodID\" value=\"$productID\"><input type=\"image\" src=\"images/delete.jpg\" alt=\"submit button\" name=\"submit\" onclick=\"return confirm('Are you sure you want to delete the product called $productID?')\" value=\"Delete Product\"></form></td>\n";

echo "<td align=center><form name=\"passDelete\" method=\"post\" action=\"editDatabase.php?id=$productID\"><input type=\"hidden\" name=\"prodID\" value=\"$productID\"><input type=\"image\" src=\"images/edit.jpg\" alt=\"submit button\" name=\"submit\" value=\"Edit Product\"></form></tr>\n";

echo "<td align=center><form name=\"editLim\" method=\"post\" action=\"editLimit.php?id=$productID\"><input type=\"checkbox\" name=\"prodID\" value=\"$productID\"></form></td>\n";

}

echo "</table></center>";

?>

 

 

here's what it looks like at present:

35052576.jpg

Link to comment
https://forums.phpfreaks.com/topic/147000-solved-check-boxes-within-a-while-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.