PHP for the World Wide Web, Second Edition: Visual Quickstart Guide

Book description

So you know HTML, even JavaScript, but the idea of learning an actual programming language like PHP terrifies you? Well, stop quaking and get going with this easy task-based guide! Aimed at beginning PHP developers just like yourself, this volume uses step-by-step instructions and plenty of visual aids to get you started testing scripts, using basic syntax, working with variables, creating Web applications, and everything else you need to know to create dynamic Web pages with this increasingly popular and important scripting language. Along the way, you'll learn about all that's new in version 5: the new Zend Engine, updated XML support, greatly improved streams (now able to access low-level socket operations), a bundled copy of SQLite, and more. Throughout the book, you'll find sample scripts and projects as well as the timesaving tips and techniques that have become the hallmark of the popular Visual QuickStart series. A companion Web site offers all of the book's scripts for download.

Table of contents

  1. Copyright
    1. Dedication
  2. Special thanks
  3. Introduction
    1. What Is PHP?
    2. Why Use PHP?
    3. How PHP Works
    4. What You’ll Need
    5. About This Book
    6. Companion Web Site
      1. Questions, comments, or suggestions?
  4. 1. Getting Started with PHP
    1. Basic XHTML Syntax
    2. Basic PHP Syntax
    3. Testing Your Script
    4. Sending Text to the Browser
    5. Sending HTML to the Browser
    6. Using White Space in PHP and HTML
    7. Adding Comments to Your Scripts
  5. 2. Variables
    1. What Are Variables?
    2. Variable Syntax
    3. Types of Variables
      1. Numbers
      2. Strings
      3. Arrays
      4. Objects
    4. Assigning Values to Variables
    5. Understanding Quotation Marks
  6. 3. HTML Forms and PHP
    1. Creating a Simple Form
    2. Using GET or POST
    3. Receiving Data from a Form in PHP
    4. Displaying Errors
    5. Error Reporting
    6. The Register Globals Problem
    7. Manually Sending Data to a Page
  7. 4. Using Numbers
    1. Creating the Form
    2. Adding, Subtracting, Multiplying, and Dividing
    3. Formatting Numbers
    4. Using Multiple Operators
    5. Incrementing and Decrementing a Number
    6. Creating Random Numbers
  8. 5. Using Strings
    1. Creating the HTML Form
    2. Connecting Strings (Concatenation)
    3. Combating Magic Quotes
    4. HTML and PHP
    5. Encoding and Decoding Strings
    6. Replacing Parts of a String
    7. Other String Functions
  9. 6. Control Structures
    1. Creating the HTML Form
    2. The if Conditional
    3. Using else
    4. More Operators
      1. Comparison
      2. Logical
    5. Using elseif
    6. The Switch Conditional
    7. The for Loop
  10. 7. Using Arrays
    1. What Is an Array?
      1. Syntactical rules for arrays
    2. Creating an Array
    3. Adding Items to an Array
    4. Accessing Array Elements
    5. Creating Multidimensional Arrays
    6. Sorting Arrays
    7. Transforming Between Strings and Arrays
    8. Creating an Array from a Form
  11. 8. Creating Web Applications
    1. Creating Templates
    2. Using External Files
    3. Using Constants
    4. Working with the Date and Time
    5. Handling HTML Forms with PHP, Revisited
    6. Making Forms Sticky
    7. Sending Email
    8. Output Buffering
    9. Manipulating HTTP Headers
  12. 9. Cookies and Sessions
    1. What Are Cookies?
    2. Creating Cookies
    3. Reading from Cookies
    4. Adding Parameters to a Cookie
    5. Deleting a Cookie
    6. What Are Sessions?
    7. Creating a Session
    8. Accessing Session Variables
    9. Deleting a Session
  13. 10. Creating Functions
    1. Creating and Using Simple Functions
    2. Creating and Calling Functions that Take Arguments
    3. Setting Default Argument Values
    4. Creating and Using Functions that Return a Value
    5. Understanding Variable Scope
  14. 11. Files and Directories
    1. File Permissions
      1. Creating the text file
      2. Setting a file’s permissions
    2. Writing to Files
    3. Locking Files
    4. Reading from Files
    5. Handling File Uploads
    6. Navigating Directories
    7. Creating Directories
    8. Reading Files Incrementally
  15. 12. Intro to Databases
    1. Introduction to SQL
    2. Connecting to MySQL
    3. MySQL Error Handling
    4. Creating and Selecting a Database
    5. Creating a Table
    6. Inserting Data into a Database
    7. Retrieving Data from a Database
    8. Deleting Data in a Database
    9. Updating Data in a Database
  16. 13. Regular Expressions
    1. What Are Regular Expressions?
    2. Matching Patterns
    3. Using Literals
    4. Using Metacharacters
    5. Using Quantifiers
    6. Using Classes
    7. Matching and Replacing Patterns
  17. A Installation and Configuration
    1. Installing on Windows 2000
    2. Installing on Mac OS X
    3. Using the MySQL Monitor
    4. Creating MySQL Users
      1. Setting the root user password
      2. Creating users and privileges
    5. PHP Configuration
  18. B. Resources
    1. Online PHP Resources
      1. The PHP manual
      2. General PHP Web sites
      3. Code repositories
      4. Newsgroups and mailing lists
    2. Database Resources
    3. Advanced Topics
      1. OOP and PEAR
      2. Security
    4. Top Ten Frequently Asked Questions (or Problems)
    5. Tables

Product information

  • Title: PHP for the World Wide Web, Second Edition: Visual Quickstart Guide
  • Author(s): Larry Ullman
  • Release date: January 2004
  • Publisher(s): Peachpit Press
  • ISBN: 9780321245656