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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.