simon551 Posted June 7, 2007 Share Posted June 7, 2007 I have this form that reads some info in a database that is available for inserting into another table. on each row I have a checkbox. I'd like to take the info out where there is a checkbox marked and insert into my table. Make sense? Any idea how to do this. This is my form: <form id="form1" name="form1" method="post" action=""> <table width="100%" border="0"> <?php do { ?> <tr> <td><?php echo $row_rsSowCats['sowcatID']; ?></td> <td><?php echo $row_rsSowCats['sowCategory']; ?></td> <td> <input type="checkbox" name="checkbox" value="checkbox" /> </td> <td> </td> </tr> <?php } while ($row_rsSowCats = mysql_fetch_assoc($rsSowCats)); ?> </table> </form> Not sure how to pull out the info that is selected in order to write into my simple query $array = $query="INSERT INTO table VALUES $array"; Link to comment https://forums.phpfreaks.com/topic/54512-bulk-insert/ Share on other sites More sharing options...
Dragen Posted June 7, 2007 Share Posted June 7, 2007 the checkbox would have to have a name corresponding to whichever row you want it to effect.. such as: <input type="checkbox" name="checkbox<?php echo $row_rsSowCats['sowcatID']; ?>" value="checkbox" /> then on your page for checking it have an isset check. <?php if(isset($_POST['checkbox1'])){ //the checkbox is checked }else{ //the checkbox is not checked } ?> obviously if you don't want to do this for every checkbox you could use a foreach statement to go thrtough them Link to comment https://forums.phpfreaks.com/topic/54512-bulk-insert/#findComment-269621 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.