O'Reilly logo

PHP and MySQL® For Dummies®, 4th Edition by Janet Valade

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

Chapter 6. General PHP

In This Chapter

  • Adding PHP sections to HTML files

  • Writing PHP statements

  • Using PHP variables

  • Comparing values in PHP variables

  • Documenting your programs

Programs are the application part of your Web database application. Programs perform the tasks: Programs create and display Web pages, accept and process information from users, store information in the database, get information out of the database, and perform any other necessary tasks.

PHP, the language that you use to write your programs, is a scripting language designed for use on the Web. It has features to aid you in programming the tasks needed by dynamic Web applications.

In this chapter, I describe the general rules for writing PHP programs — the rules that apply to all PHP statements. Consider these rules similar to general grammar and punctuation rules. In the remaining chapters in Part III, you find out about specific PHP statements and features and how to write PHP programs to perform specific tasks.

Adding a PHP Section to an HTML Page

PHP is a partner to HTML, enabling HTML to do things it can't do on its own. For example, HTML can display Web pages, and HTML has features that allow you to format those Web pages. HTML also allows you to display graphics in your Web pages and to play music files. But HTML alone does not allow you to interact with the person viewing the Web page.

HTML is almost interactive. That is, HTML forms allow users to type information that the Web page is designed to collect; however, ...

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