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.

43 lines
1.5 KiB

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