Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. <html>
  2. <head>
  3.  
  4. </head>
  5. <body>
  6. <?php
  7. require('process.php');
  8.  
  9. $db_con = new MySqlDrive();
  10. $query = "SELECT * FROM student";
  11. // $result = $db_con->read($query);
  12. $result = mysqli_query($db_con->db_connect(), $query);
  13. // var_dump($result);
  14. ?>
  15.  
  16. <?php if(isset($_SESSION['message'])): ?>
  17.  
  18. <div>
  19. <h3>
  20. <?php echo $_SESSION['message']; ?>
  21. </h3>
  22. </div>
  23.  
  24. <?php endif ?>
  25.  
  26. <div class="row">
  27. <table>
  28. <thead>
  29. <tr>
  30. <th>Name</th>
  31. <th>Phone</th>
  32. <th>Roll</th>
  33. <th>Action</th>
  34. </tr>
  35. </thead>
  36. <tbody>
  37. <?php while($row = $result->fetch_assoc()){ ?>
  38. <tr>
  39. <td><?php echo $row['name']; ?></td>
  40. <td><?php echo $row['phone']; ?></td>
  41. <td><?php echo $row['roll']; ?></td>
  42. <td>
  43. <a href="index.php?edit=<?php echo $row['id']?>">Edit</a>
  44. <a href="process.php?delete=<?php echo $row['id']?>">Delete</a>
  45. </td>
  46. </tr>
  47. <?php } ?>
  48. </tbody>
  49. </table>
  50.  
  51. </div>
  52. <br>
  53. <form action="process.php" method="POST">
  54. <label for="">Name</label>
  55. <input type="text" value="<?php echo $name;?>" name="name">
  56. <label for="">Phone</label>
  57. <input type="text" value="<?php echo $phone;?>" name="phone">
  58. <label for="">Roll</label>
  59. <input type="number" value="<?php echo $roll;?>" name="roll">
  60. <input type="hidden" value="<?php echo $id;?>" name="id">
  61. <?php if($update == true): ; ?>
  62. <button type="submit" name="update">Update</button>
  63. <?php else: ?>
  64. <button type="submit" name="save">Submit</button>
  65. <?php endif ;?>
  66. </form>
  67. </body>
  68. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement