Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form action="coll.php" method="post" name="create_grading" id="create_grading">
- <table width="30%" border="0" cellpadding="2" cellspacing="3" class="mainTable">
- <tr>
- <th><input type="checkbox" id="selectall" /></th>
- <th>name</th>
- </tr>
- <?php
- $sql = "select * from employee";
- $query = mysqli_query($con, $sql);
- while ($row = mysqli_fetch_array($query)) {
- ?>
- <tr>
- <td><input type="hidden" name="eid[]" value="<?php echo $row['eid']; ?>"/>
- <input name="status[]" class="case" type="checkbox" value="1" /><input name="status[]" class="case" type="hidden" value="0" /></td>
- <td align="center"><?php echo $row['employee_name'] ?></td>
- </tr>
- <?php }; ?>
- <tr>
- <td></td>
- <td><input type="submit" name="Submit" id="Submit" value="Submit" /></td>
- </tr>
- </table>
- </form>
- $host = "localhost";
- $user = "root";
- $pass = "";
- $db = "multiple_row_insert";
- $con = mysqli_connect($host, $user, $pass, $db);
- if (isset($_POST['Submit'])) {
- $eid = $_POST['eid'];
- $count = count($eid);
- for ($i = 0; $i < $count; $i++) {
- $status = $_POST['status'][$i];
- $eid2 = $_POST['eid'][$i];
- $query = "INSERT INTO time(eid,status) VALUES ('$eid2','$status')";
- $query = mysqli_query($con, $query);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement