this practice assignment wants me to:  Create a document named ShowGuestBook.php that dis- plays the names of visitors who have signed the guest book. Use the readfile() function to display the contents of the guestbook.txt file. Note that you will need to use the element for Web browsers to recognize the line breaks. here is my two PHP files and my html codes.  I am getting an ( ! ) Parse error: syntax error, unexpected 'POST' (T_STRING) on SignGuestBook.php on line 10! i cant seem to figure out whats the issue , help please!! GuestBook.html Guest Book Enter your name to sign our guest book First Name Last Name Show Guest Book   SignGuestBook.php Sign Guest Book You must enter your first and last name. Click your browser's Back button to return to the Guest Book.\n"; else { $FirstName = addslashes($_POST['first_name']); $LastName = addslashes($_POST['last_name']); $GuestBook = fopen("guestbook.txt", "ab") if (is_writeable("guestbook.txt")) { if (frwite($GuestBook, $LastName . ", " . $FirstName . "\n")) echo "Thank you for signing our guest book!\n"; else echo "Cannot add your name to the guest book\n"; else fclose($GuestBook); echo "Cannot write to the file.\n"; } } ?>   ShowGuestBook.php Show Guest Book

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

this practice assignment wants me to:  Create a document named ShowGuestBook.php that dis- plays the names of visitors who have signed the guest book. Use the readfile() function to display the contents of the guestbook.txt file. Note that you will need to use the element for Web browsers to recognize the line breaks.

here is my two PHP files and my html codes.  I am getting an ( ! ) Parse error: syntax error, unexpected 'POST' (T_STRING) on SignGuestBook.php on line 10! i cant seem to figure out whats the issue , help please!!

GuestBook.html

<!DOCTYPE>

<html>
<head>
<title>Guest Book</title>
</head>

<body>
<h2> Enter your name to sign our guest book </h2>
<form method="POST" action="SignGuestBook.php">
<p>First Name <input type="text" name="first_name"/></p>
<p>Last Name <input type="text" name="last_name"/></p>
<p><input type="submit" value="Submit" /></p>
</form>
<p><a href="ShowGuestBook.php">Show Guest Book</a></p>

</body>
</html>

 

SignGuestBook.php

<!DOCTYPE>

<html>
<head>
<title>Sign Guest Book</title>
</head>

<body>
<?php
if (empty($_POST['first_name']) || empty($_ POST['last_name']))
echo "<p>You must enter your first and last name. Click your browser's Back button to return to the Guest Book.</p>\n";

else {
$FirstName = addslashes($_POST['first_name']);
$LastName = addslashes($_POST['last_name']);
$GuestBook = fopen("guestbook.txt", "ab")
if (is_writeable("guestbook.txt")) {
if (frwite($GuestBook, $LastName . ", " . $FirstName . "\n"))
echo "<p>Thank you for signing our guest book!</p>\n";
else
echo "<p>Cannot add your name to the guest book</p>\n";

else fclose($GuestBook);
echo "<p>Cannot write to the file.</p>\n";

}
}
?>
</body>
</html>

 

ShowGuestBook.php

<!DOCTYPE>

<html>
<head>
<title>Show Guest Book</title>
</head>

<body>
<?php
echo readfile("guestbook.txt")
?>
</body>
</html>

 

Expert Solution
Step 1

Actually, given information regarding php.

 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY