Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- require('connection.php');
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Peon</title>
- <link rel="stylesheet" href="assets/css/style.css">
- <link rel="stylesheet" href="assets/css/bootstrap.min.css" />
- </head>
- <body>
- <?php
- if(ISSET($_SESSION['id'])) {
- $id = $_SESSION['id'];
- $fetch = "SELECT * FROM user_info WHERE id='$id';";
- $query = mysql_query($fetch);
- if(!$query) {
- echo mysql_error();
- } else {
- $array=mysql_fetch_array($query);
- ?>
- <h1 style="text-align:center">Welcom to you profile page <span><?php echo $array['name']; ?></span></h1>
- <?php
- }
- }
- ?>
- <div id="peon">
- <form name="attendence_form" action="" method="POST">
- <table class="table table-bordered">
- <tr>
- <th>Teacher Name</th>
- <th>Subject</th>
- <th>Class</th>
- <th>Room #</th>
- <th>Attendence</th>
- <th>Submit</th>
- </tr>
- <?php
- $fetch = "SELECT * FROM period;";
- $query = mysql_query($fetch);
- if(!$query) {
- echo mysql_error();
- } else {
- WHILE($array = mysql_fetch_array($query)) {
- ?>
- <tr>
- <td><input type="text" value="<?php echo $array['teacher_name']; ?>" class="form-control" name="t_name[]" /></td>
- <td><input type="text" value="<?php echo $array['subject']; ?>" class="form-control" name="subject[]" /></td>
- <td><input type="text" value="<?php echo $array['class']; ?>" class="form-control" name="class[]" /></td>
- <td><input type="text" value="<?php echo $array['room']; ?>" class="form-control" name="room[]" /></td>
- <td>
- <select name="attendence[]" class="form-control">
- <option value="Present">Present</option>
- <option value="Absent">Absent</option>
- </select>
- </td>
- <td><button type="submit" name="btn_sub" class="btn btn-default">Submit</button></td>
- </tr>
- <?php
- }
- }
- ?>
- </table>
- </form>
- </div>
- <?php
- if (ISSET($_POST['btn_sub'])) {
- $count = $_POST['t_name'];
- for ($i = 0; $i < $count; $i++) {
- $teacher = $_POST['t_name'][$i];
- $subject = $_POST['subject'][$i];
- $class=$_POST['class'][$i];
- $room=$_POST['room'][$i];
- $attendence=$_POST['attendence'][$i];
- $insert="INSERT INTO atendence (teacher_name,subject,class,room,attendence) VALUE ('$teacher','$subject','$class','$room','$attendence');";
- $quer=mysql_query($insert);
- if(!$query) {
- echo mysql_error();
- }
- }
- header('location: yourphp.php');
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement