Advertisement
Guest User

Untitled

a guest
Nov 17th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <form action="coll.php" method="post" name="create_grading" id="create_grading">
  2. <table width="30%" border="0" cellpadding="2" cellspacing="3" class="mainTable">
  3. <tr>
  4. <th><input type="checkbox" id="selectall" /></th>
  5. <th>name</th>
  6. </tr>
  7. <?php
  8. $sql = "select * from employee";
  9. $query = mysqli_query($con, $sql);
  10. while ($row = mysqli_fetch_array($query)) {
  11. ?>
  12. <tr>
  13. <td><input type="hidden" name="eid[]" value="<?php echo $row['eid']; ?>"/>
  14. <input name="status[]" class="case" type="checkbox" value="1" /><input name="status[]" class="case" type="hidden" value="0" /></td>
  15. <td align="center"><?php echo $row['employee_name'] ?></td>
  16. </tr>
  17. <?php }; ?>
  18.  
  19. <tr>
  20. <td></td>
  21. <td><input type="submit" name="Submit" id="Submit" value="Submit" /></td>
  22. </tr>
  23. </table>
  24. </form>
  25.  
  26. $host = "localhost";
  27. $user = "root";
  28. $pass = "";
  29. $db = "multiple_row_insert";
  30. $con = mysqli_connect($host, $user, $pass, $db);
  31.  
  32.  
  33. if (isset($_POST['Submit'])) {
  34. $eid = $_POST['eid'];
  35. $count = count($eid);
  36. for ($i = 0; $i < $count; $i++) {
  37. $status = $_POST['status'][$i];
  38. $eid2 = $_POST['eid'][$i];
  39. $query = "INSERT INTO time(eid,status) VALUES ('$eid2','$status')";
  40. $query = mysqli_query($con, $query);
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement