简体   繁体   中英

how to insert all this checkbox value into same id but different rows of one column?

how to insert all this checkbox value into same id but different rows of one column

<input type="checkbox" value="Return" name ="secondtechno[]">Return<br>
<input type="checkbox" value="Payment" name ="secondtechno[]">Payment<br>
<input type="checkbox" value="Audit" name = "secondtechno[]">Audit<br>
<input type="checkbox" value="Form15CA" name = "secondtechno[]">Form15CA<br>
<input type="checkbox" value = "Form15CB" name = "secondtechno[]">Form15CB<br>

You can use below code in php to check the checked box values using array and try to insert inside foreach with that particular id

$id= 'Your_id';
if(!empty($_POST['secondtechno'])) {
    foreach($_POST['secondtechno'] as $check) {
            //echo $check;
            //$sql = "INSERT INTO YourTable(id, columnname)VALUES ('".$id."', '".$check."')";
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM