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.

46 lines
1.3 KiB

  1. <?php
  2. if($loggedIn)
  3. {
  4. $errors = array();
  5. if(isset($_POST['newPerson']))
  6. {
  7. $i_first = mysqli_real_escape_string($dbc,
  8. trim($_POST['person_first']));
  9. $i_last = mysqli_real_escape_string($dbc,
  10. trim($_POST['person_last']));
  11. $q = "insert into people (name, creation_date) values ('"
  12. . $i_first . " " . $i_last . "' , now())";
  13. $r = mysqli_query($dbc, $q);
  14. header("Location: quotes.php");
  15. }
  16. echo '<h1 class="w3-text-teal"><center>New Person</center></h1>';
  17. echo '<form action="quotes.php" method ="post" class="w3-container
  18. w3-card-4">
  19. <div class="w3-group">
  20. <input class="w3-input" type="text" name="person_first" required>
  21. <label class="w3-label w3-validate">First Name</label>
  22. </div>
  23. <div class="w3-group">
  24. <input class="w3-input" type="text" name="person_last" required>
  25. <label class="w3-label w3-validate">Last Name</label>
  26. </div>
  27. <p><input type="submit" name="Submit" value="Add Person"
  28. class="w3-padding-16 w3-hover-dark-grey w3-btn-block w3-center-align" /></p>
  29. <input type="hidden" name="newPerson" value="TRUE" />
  30. </form>';
  31. foreach($errors as $msg)
  32. echo " - $msg<br />";
  33. }