web development exercise 5 2
Would you like us to handle your paper? Use our company for better grades and meet your deadlines.
Order a Similar Paper Order a Different Paper
Exercise 5-2_x000D_ In this project, you will create a Web page that allows visitors to your_x000D_ site to sign a guest book that is saved to a text ï¬le. Ensure that the_x000D_ Projects directory has read and write permissions for everyone.
1. Create a new document in your text editor and type the_x000D_ declaration, element, document head, and_x000D_ element. Use the strict DTD and “Guest Book†as the_x000D_ content of the element.
2. Add the following text and elements to the document body:_x000D_ Enter your name to sign our guest book_x000D_ _x000D_ First Name _x000D_ Last Name
Show Guest Book_x000D_ _x000D_ _x000D_ 3. Save the document as GuestBook.html in the Projects direc-_x000D_ tory for Chapter 5._x000D_ _x000D_ 4. Create a new document in your text editor and type the_x000D_ declaration, element, document head, and_x000D_ element. Use the strict DTD and “Sign Guest Book†as_x000D_ the content of the element._x000D_ _x000D_ 5. Add the following script section to the document body:_x000D_ _x000D_ _x000D_ 6. Add the following if statement to the script section to check_x000D_ whether the user ï¬lled in the ï¬rst name and last name ï¬elds:_x000D_ if (empty($_POST['ï¬rst_name']) || empty($__x000D_ POST['last_name']))_x000D_ echo "You must enter your ï¬rst and last_x000D_ name. Click your browser's Back button to_x000D_ return to the Guest Book.n";_x000D_ _x000D_ 7. Add the following else clause to the end of the script section._x000D_ The statements in the else clause use the fwrite() function_x000D_ to add visitor names to a text ï¬le named guestbook.txt._x000D_ else {_x000D_ $FirstName = addslashes($_POST['ï¬rst_name']);_x000D_ $LastName = addslashes($_POST['last_name']);_x000D_ $GuestBook = fopen("guestbook.txt", "ab");_x000D_ if (is_writeable("guestbook.txt")) {_x000D_ if (fwrite($GuestBook, $LastName . ", " ._x000D_ $FirstName . "n"))_x000D_ echo "Thank you for signing our_x000D_ guest book!n";_x000D_ else_x000D_ echo "Cannot add your name to the_x000D_ guest book.n";_x000D_ }
else_x000D_ echo "Cannot write to the ï¬le.n";_x000D_ fclose($GuestBook);_x000D_ }_x000D_ _x000D_ 8. Save the document as SignGuestBook.php in the Projects_x000D_ directory for Chapter 5._x000D_ 291_x000D_ 9. Create a document named ShowGuestBook.php that dis-_x000D_ plays the names of visitors who have signed the guest book._x000D_ Use the readï¬le() function to display the contents of the_x000D_ guestbook.txt ï¬le. Note that you will need to use the _x000D_ element for Web browsers to recognize the line breaks._x000D_ _x000D_ 10. Open GuestBook.html in your Web browser by enter-_x000D_ ing the following URL: http:///PHP_Projects/_x000D_ Chapter.05/Projects/GuestBook.html. Test the form to see if_x000D_ you can write data to and read data from the guestbook.txt_x000D_ ï¬le._x000D_ _x000D_ 11. Close your Web browser window._x000D_

Do you need help with this or a different assignment? We offer CONFIDENTIAL, ORIGINAL (Turnitin/LopesWrite/SafeAssign checks), and PRIVATE services using latest (within 5 years) peer-reviewed articles. Kindly click on ORDER NOW to receive an A++ paper from our masters- and PhD writers. Get a 15% discount on your order using the following coupon code SAVE15
Order a Similar Paper Order a Different Paper