<body> <?php $books_query=mysql_query("select * from labour"); $num_rows = mysql_num_rows($books_query); while($books_rows=mysql_fetch_array($books_query)){ ?> <form method="post"> <table> <tr> <td><?php echo $books_rows['labour_id'] ; ?></td> <td>in:</td><td><input type="text" name="l_in"></td> <td>out:</td><td><input type="text" name="l_out"></td> </tr> </table> <?php }?> <td></td><td><input type="submit" name="submit" value="submt"/></td> </form> <? if (isset($_POST['submit'])){ for($i=1; $i <= $num_rows; $i++) { $lid=mysql_query("select labour_id from labour"); $sql="INSERT INTO labour_attendance (emp_id,l_in,l_out) VALUES ('$lid','$_POST[l_in]','$_POST[l_out]')"; $result = mysql_query($sql); if (!$result) { die('Invalid query: ' . mysql_error()); } } } ?>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)