Over 10 Million Study Resources Now at Your Fingertips


Download as :
Rating : ⭐⭐⭐⭐⭐
Price : $10.99
Language:EN
Pages: 2

Php includes the htmlspe-cialchars function

636

LESSON 21: Taking Advantage of the Server

<form action=”post.php” method=”post”>
Enter your name: <input type=”text” name=”yourname” /><br /> <input type=”submit” />
</form>

When the user submits the form, the value of the yourname field will be available in $_POST and $_REQUEST. You could return it to the user like this:

Processing Forms 637

them as markup. Or if you prefer, you can use htmlentities(), which encodes all the characters that are encoded by htmlspecialchars() plus any other characters that can be represented as entities. In the preceding example, you really want to write the script that displays the user’s name like this:

<p>Hello <?= htmlspecialchars($_POST[‘yourname’]) ?>. Thanks for visiting.</p>

Handling Parameters with Multiple Values

Most form fields are easy to deal with; they’re simple name and value pairs. If you have a text field or radio button group, for example, you can access the value submitted using $_REQUEST, like this:

21
How It Works
Login account
Login Your Account
Add to cart
Add to Cart
Payment
Make payment
Document download
Download File
PageId: ELIF3CECA1
img
Uploaded by :
ZRWAWB5v
Page 1 Preview
php includes the htmlspecialchars function
Sell Your Old Documents & Earn Wallet Balance