Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!empty ($_POST["fname"]) && !empty($_POST["lname"]))
- {
- $fname = $_POST["fname"];
- $lname = $_POST["lname"];
- $filename = "myguestbook.txt";
- $handle = fopen($filename, "a");
- $data = $fname . " " . $lname . "\n";
- if (fwrite($handle, $data)) {
- echo "Thank you for signing the guest book!<br><br>";
- echo '<a href="guestbookshow.php">Show Guest Book</a>';
- fclose($handle);
- }
- else {
- echo "Cannot add your name to the Guest Book.";
- }
- } else {
- echo "<p>Please go back and enter the First name and Last name.</p>";
- echo '<a href="guestbookshow.php">Show Guest Book</a>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement