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

762

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>
696

Answer

Solution:

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."')";
    }
}

People are also looking for solutions to the problem: ASP DLL inside PHP code

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.