O'Reilly logo

PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition by Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Managing Magic Quotes

Built into PHP is a handy feature referred to as Magic Quotes. Magic Quotes—when enabled—will automatically escape single and double quotation marks in the values of variables. This can help prevent problems when working with databases or HTML. But, if I enter into a form some text that includes an apostrophe (Figure 2.5), the resulting page looks strange when the text is reprinted (Figure 2.6).

Figure 2.5. Quotation marks entered into form values can be disruptive in your Web applications (see Figure 2.6).

Figure 2.6. The apostrophe entered in the form was escaped automatically by PHP, generating unseemly results.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required