Hello, I have a part of my form filled with drop-boxes, those are being loaded dynamically by a query, how can i save the ID from every value that is checked by users, comma sepperated... <html> <table width="100%" border="0" cellpadding="0"> <?php $objCon1 = new cDatabase; $objFun1 = new cFunction; if(($link=$objCon1->connectMYSQL())!=FALSE){ // connect mysql if($objCon1->connectDB($link)!=FALSE){ // select databasen; $sQry = "select * from categories"; if($result=@mysql_query($sQry)) { ?> <tr><?php while($rec=mysql_fetch_array($result)) { ?> <th width="344" align="left" valign="top" scope="col"><p><?php echo $rec['Catname']; ?><br> <?php $sQry1 = "select * from subcategories where subcategories.catid=".$rec['Catid'].""; if($result1=@mysql_query($sQry1)) { while($rec1=mysql_fetch_array($result1)) { ?> <input type="checkbox" name="checkbox2" id="checkbox2"> <?php echo $rec1['Subcatname']; ?> <br> <?php } } ?> </th> </th> <?php }} } } ?> </tr> </table> </html>
Try these changes within the loop: <input type="checkbox" name="checkbox2[]" id="checkbox2" value="<?php echo $rec1['Subcatname']; ?>"> <?php echo $rec1['Subcatname']; ?> HTML: (added square brackets to element name [] and added value attribute) This will submit the element as an array so you can pick it up by looping $_POST['checkbox2'];