如何通过复选框选择表中的多行,并将这些值传递给另一个表

I want to select multiple rows in a table via checkboxes and store these values in another table.I have almost done. But problem is that when I select multiple rows and get these values via array. It only fetch single value. I want all selected values. Please help me in this regard. My code is given below.

<form class="form-horizontal" method="post" action="add_exam_quiz.php" role="form" id="form1">
  <tr>
    <td>
      <input type="checkbox" name="quiz_question[<?php echo  $question_no; ?>]" value="<?php echo  $question_no; ?>">
      <?php echo  $question_no; ?> 
    </td>
</form>
</tr>

<input class="btn btn-primary" type="submit" name="submit" value="submit" form="form1">

I expect an array with all checked values. But I got single value.

You need to have all the checkboxes with the same name like this:

<td><input type="checkbox" name="quiz_question[]" value="<?php echo  $question_no; ?>"> <?php echo  $question_no; ?> </td>

then in PHP:

<?php

   $quiz_question = $_POST['quiz_question'];

   foreach ($quiz_question as $question=>$value) {
             echo $value."<br />";
        }

?>

Try to give same NAME for all check box options. If you give different NAME it won't work.