Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1.   <?php
  2.  if (!empty ($_POST["fname"]) && !empty($_POST["lname"]))
  3.  {
  4. $fname = $_POST["fname"];
  5. $lname = $_POST["lname"];
  6. $filename = "myguestbook.txt";
  7. $handle = fopen($filename, "a");
  8. $data = $fname . " " . $lname . "\n";
  9. if (fwrite($handle, $data)) {
  10.  
  11.         echo "Thank you for signing the guest book!<br><br>";
  12.         echo '<a href="guestbookshow.php">Show Guest Book</a>';
  13.         fclose($handle);
  14.  
  15. }
  16.  
  17. else {
  18.  
  19.         echo "Cannot add your name to the Guest Book.";
  20.  
  21. }
  22.  
  23.  } else {
  24.  
  25. echo "<p>Please go back and enter the First name and Last name.</p>";
  26. echo '<a href="guestbookshow.php">Show Guest Book</a>';
  27. }
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement