简体   繁体   English

如何将所有此复选框值插入相同的ID,但在一列的不同行中?

[英]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 如何将所有此复选框值插入同一ID但同一列的不同行中

<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 您可以在php中使用以下代码来检查使用数组的复选框的值,并尝试在具有特定ID的foreach中插入

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将多个值插入到具有不同行的一列上? - How to insert multiple value onto one column with different rows? 如何在数据库中具有相同ID的多行中插入复选框的多个值 - How to insert multiple values of checkbox in multiple rows with same id in database 如何插入两个表; 一个将插入 1 行,另一个将插入多行,两个表的一列具有相同的值 - how to insert into two tables; one will insert 1 row and the other one will insert multiple rows, the two tables has one column with the same value 获取不同列中具有相同值的所有行的列值之和 - Get the sum of a column value for all rows with same value in different column 如何将一个值插入不同的行 - how to insert one value to different rows 如何计算具有相同值但不同 id 的行 - How to count rows with the same value but different id 如何在与mysql中的旧值具有相同ID的列中插入新值 - how to insert new value in column with same id with old value in mysql 如何在相同ID但不同列值下插入值? - how to insert values under same id but different column values? 如何在一行中获取具有相同 id 但在另一列中具有不同值的数据并在 php 中的表中显示一个月 - How to fetch data with same id in a row but different value in another column and display one month into table in php 如何在同一个表中显示具有相同列不同 id 的 2 个值 - How to show 2 value with same column different id in same tables
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM