kevinak Posted September 10, 2008 Share Posted September 10, 2008 Hello. I have a query that checks for pet IDs based off a user's id. It generates a table with all the ones that it finds with this code //checks if any results are returned if (mysql_num_rows($resultpets) > 0) { //sets up my table echo"<table border=1 width=500>"; //For each pet id found, it will add a column while($row = mysql_fetch_row($resultpets)) { echo "<tr><td><center><img src=http://whimpsters.net/pets.php/".$row[0]." style='border-style: none'><input type=checkbox name=".$petname[$row]." value=".$row[0]." /></td>"; //4 more columns to make 5 column rows The key point to this being... <input type=checkbox name=".$petname[$row]." value=".$row[0]." /> Now I have the checkbox's name to equal the array $petname[petid] and the value is just the pet id number. Now, using a for each loop, how can I check which check boxes have been marked? Would it be anything like this foreach($petname as $key => $value) { if(isset($key)) { //do stuff for checked boxes } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.