Variables illustration


The current date and time is February 4th, 2012 2:16:PM

Companion Web Site

Larry Ullman has a web site devoted to PHP for the World Wide Web: Second Edition at this location.

It is intended as a supplement /complement to the book and has many helpful resources.

The Book

Variable image

PHP for the World Wide Web: Second Edition written by Larry Ullman

Chapter 5
Using Strings

About Strings

This chapter dealt with trimming, joining and encoding strings. Remembering that a variable is a container for data and that strings are the most common type of variable, we begin using strings in form responses. Strings are containers of characters, meaning anything from a single letter, code, words, numbers, nonsense to symbols and so on! A string will be printed out in the case of form responses as names, email addresses and the sentences that the user types into the text area. String functions will change the way the output (printed data) will be presented.

The handle_post file went through many alterations, all having to do with string functions, including one which will catch bad words (if you use whatever bad words you want or think possible instead of the generic badword)! If you type 'badword' into the posting below, the string_replace() function will replace it with xxxxx in the handle_post page.

The Form

Complete and submit your posting

First Name:
Last name:
Email Address:
Posting:

Magic Quotes

I now know that Magic Quotes are enabled on my server and so I will need to use the stripslashes() function. I finally understand the reasoning why! Look at this and notice the slashes in the reply. It is because I experimented using " " in my reply. Also applies to '. Need stripslashes??
So, back to the form and put in the stripslashes() function... but now, I know why! I remember doing this when Krisse and I were in the first PHP 101 and I didn't know why! It is good to know why!

 



Warning: show_source() has been disabled for security reasons in /home/rjoannej/public_html/ullmanBook/chapter5.php on line 131

Warning: show_source() has been disabled for security reasons in /home/rjoannej/public_html/ullmanBook/chapter5.php on line 135