jquery - Get checked checkbox Value and send it to php variable for query -


this code table , checkboxes, i'm trying checked box values, , put theme select query. don't have idea, how that. can 1 me? i'm new programming, don't punch me please ;)

idea of script -> user choose row want edit checking checkboxes, script must read values of checkboxes, , in modal popup window show entries.

                          <?php                                                    while($row = mysqli_fetch_array($result))                                   {                                       echo '                                           <tr>                                           <td>'.$row["employeeid"].'</td>                                           <td>'.$row["employeefirstnamelocal"].'</td>                                           <td>'.$row["employeelastnamelocal"].'</td>                                           <td>'.$row["govermentid"].'</td>                                           <td>'.$row["factworkplace"].'</td>                                          <td>'.$row["merge"].'</td>                                         <td><form name="" action="" method="post"><input type="checkbox" name="checkbox[]"  id="checkbox" value="'.$row["employeeid"].'" class="chk"></form></td>                                                                            </tr>                                               ';                                   }                             ?>                        </table>  <button type="button" class="btn btn-success pull-right" data-toggle="modal" data-target="#examplemodallong">   Объединить </button> <div class="modal fade" id="examplemodallong" tabindex="-1" role="dialog" aria-labelledby="examplemodallongtitle" aria-hidden="true">   <div class="modal-dialog  modal-lg" role="document">     <div class="modal-content">       <div class="modal-header">         <h5 class="modal-title" id="examplemodallongtitle">Объединить</h5>          <button type="button" class="close" data-dismiss="modal" aria-label="close">           <span aria-hidden="true">&times;</span>         </button>       </div>       <div class="modal-body">         <?php           $query ="select * employeetable employeeid in (11211,9533) ";           $result = mysqli_query($connect, $query);          echo "<table id='employee_data' class='table table-striped table-bordered'>";          echo "<thead>";         echo "<tr>";         echo "<td>id</td>";         echo "<td>Имя</td>";         echo "<td>Фамилия</td>";         echo "<td>Перс. код</td>";         echo "<td>Факт. место работы</td>";         echo "</tr>";          echo "</thead>";           while($row = mysqli_fetch_array($result)){           echo "<tbody>";         echo "<tr>";         echo "<tr><td>" . $row['employeeid'] . "</td><td>" . $row['employeefirstnamelocal'] . "</td><td>" . $row['employeelastnamelocal'] . "</td><td>" . $row['govermentid'] . "</td><td>" . $row['factworkplace'] . "</td></tr>";  //$row['index'] index here field name             }         echo "</tr>";         echo "</tbody>";         echo "</table>";    ?>         <div class="modal-footer">         <button type="button" class="btn btn-secondary" data-dismiss="modal">Закрыть</button>         <button type="button" class="btn btn-primary"  onclick="myfunction()">Сохранить изменения </button>       </div>     </div>   </div> </div>                              </div>                     </div>              </div>          <script>             $(document).ready(function(){               $('#employee_data').datatable();               });           </script>               <script>         function showvalues() {     var fields = $( "input[type=checkbox][name=check]:checked" ).serializearray();     $( "#results" ).empty();     jquery.each( fields, function( i, field ) {       $( "#results" ).append( field.value + " " );     });   }    $( ":checkbox, :radio" ).click( showvalues );   $( "select" ).change( showvalues );    showvalues();          </script> 


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -