This page shows you how to allow users to post their own greetings to the guestbook in a web form.
This page is part of a multi-page tutorial. To start from the beginning and see instructions for setting up, go to Creating a Guestbook.
Posting message content
In the following code sample, when the form is submitted, the application
receives a request using the HTTP POST
method and PHP makes POSTed form
variables available using the $_POST
superglobal.
The message is stored in content
. Before
displaying the message, the application checks to see if is present in the
$_POST
superglobal:
If the message is present, then special HTML characters in the message are
replaced with their corresponding HTML entities using the htmlspecialchars
function. For example, "<" is replaced by "<".