A simple php website which displays quotes on pictures of pandas.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.3 KiB

  1. <?php
  2. if($loggedIn)
  3. {
  4. if(isset($_POST['delPerson']))
  5. {
  6. $delete_id = mysqli_real_escape_string($dbc,
  7. trim($_POST['del_person_id']));
  8. $q = "delete from people where person_id='$delete_id' limit 1";
  9. mysqli_query($dbc, $q);
  10. $q = "delete from quote where person_id='$delete_id'";
  11. mysqli_query($dbc, $q);
  12. }
  13. echo '<h1 class="w3-text-teal w3-center">People</h1>';
  14. $q = "select * from people";
  15. $r = mysqli_query($dbc, $q);
  16. echo '<div class="w3-responsive w3-card-4">
  17. <table class="w3-table w3-striped w3-bordered">
  18. <thead>
  19. <tr class="w3-theme w3-center">
  20. <td>Name</td>
  21. <td>Delete</td>
  22. </tr>
  23. </thead>
  24. <tbody>';
  25. while($row = mysqli_fetch_array($r))
  26. {
  27. echo '<tr>';
  28. //display name
  29. echo "<td>" . $row['name'] . "</td>";
  30. //del
  31. echo '<td>';
  32. echo '<form action = "quotes.php" method = "post">
  33. <input type = "submit" name="Delete" value="Delete"
  34. class="w3-padding-16 w3-hover-dark-grey w3-btn-block w3-center-align"/>
  35. <input type="hidden" name="delPerson" value="TRUE">
  36. <input type="hidden" name="del_person_id" value='
  37. . $row['person_id'] . '>
  38. </form>';
  39. echo '</td>';
  40. echo '</tr>';
  41. }
  42. echo '</tbody>
  43. </table>
  44. </div>';
  45. }