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, ...

Get PHP and MySQL® For Dummies®, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.