PHP 5 (Spring Into Series)

Other Format (Print)
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 95%)
Other sellers (Other Format)
  • All (19) from $1.99   
  • New (6) from $4.43   
  • Used (13) from $1.99   

Overview

The fastest route to true PHP mastery!

So...you've been asked to pitch in on a PHP project...starting now. Or maybe one's on the horizon. Or maybe you need to get real PHP skills onto your résumé. You've done web stuff. Maybe used other scripting languages. Now you want to get productive with PHP, fast.

Welcome. We wrote this book for you. We'll leverage what you already know, so you'll go further, faster than you ever expected.

You'll get the real nuts and bolts, not theory or hooey. You'll learn through dozens of focused examples: tested for reliability, crafted for clarity, easy to adapt for your own projects.

Need specific solutions? This book's modular, high-efficiency format delivers them—instantly. Award-winning author Steven Holzner draws on his unparalleled experience teaching programming: No other PHP guide covers this much, this well, this quickly. Dig in, get started, get results—today!

  • All you need to succeed with PHP in Linux or Windows
  • Master core concepts: operators, flow control, strings, arrays, functions, and more
  • Learn essential web techniques: cookies, session management, automated email, FTP, and more
  • Use PHP 5's object model and object-oriented techniques
  • Efficiently handle text boxes, buttons, and other HTML controls
  • Create web forms, validate user input, and check browsers
  • Work with MySQL and other databases

Includes concise PHP 5 language and functional references!

All the book's programming examples are available for download on the companion web site.

Spring Into is a new series of fast-paced tutorials from Addison-Wesley. Each book in the series is designed to bring you up-to-speed quickly. Complex topics and technologies are reduced to their core components, and each component is treated with remarkable efficiency in one- or two-page spreads. Just the information you need to begin working...now! And because the books are example-rich and easy to navigate, you'll find that they make great on-the-job references after you've mastered the basics.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
Who says a PHP book can't be comprehensive and easy at the same time? Spring into PHP 5 does both, swimmingly. How? To begin with, it's organized into easy, bite-sized chunks. There are practical, ready-to-use examples everywhere. Then, there's your author, Steve Holzner, arguably the world's most experienced writer on programming. If practice makes perfect, he's gotten darned close.

So this book won't just teach you the basic syntax you'll get in any PHP book (though you'll certainly find everything you need to know about syntax here). It'll also give you virtually total control over your web applications. Want your app to send email and use FTP? Speak SQL to your database? Recover from errors without crashing? It's all here. So is a crystal-clear introduction to PHP 5 object-oriented programming -- great for both novices and PHP scripters upgrading from ancient paradigms. Bill Camarda, from the June 2005 Read Only

Read More Show Less

Product Details

  • ISBN-13: 9780131498624
  • Publisher: Addison-Wesley
  • Publication date: 4/12/2005
  • Series: Spring Into... Series
  • Pages: 340
  • Product dimensions: 6.96 (w) x 9.18 (h) x 0.90 (d)

Meet the Author

Steven Holzner has been writing about online programming since before the Internet became the Internet. He's worked extensively with PHP and many other online languages and is the author of 88 programming books. His books have included many bestsellers, have sold more than two million copies worldwide, and have been translated into 18 languages. He's also been a contributing editor for PC Magazine. His specialties include online programming topics such as PHP, Perl, JavaServer Pages, servlets, and others.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Read an Excerpt

PrefacePreface

Welcome to PHP! This book has been written to be as comprehensive—and as accessible—as a book on PHP can be. It puts the power of PHP to work for you, pushing the envelope as far as it can go. The best way to learn any topic like PHP is by example, and this is an example-oriented book. You'll find dozens of tested examples here, ready to go to work.

PHP is quickly gaining popularity these days. Web page authors are requiring more and more power, and PHP is the answer. Not content to simply handle web pages in browsers any more, people are turning to the server side to do things you just can't do in a browser. Using PHP, you have total control over your web applications—and the good part is that they're not any harder to write than a typical web page.

PHP is an amazing package, and you're getting into it at the right time, when the excitement level is soaring. You'll see more PHP here than in any similar book, doing things you won't see other places, such as drawing images on-the-fly on the server and then sending them back to the browser. Who Should Read This Book?

This book is for you if you truly want to develop all the power of web applications. If you want to start using cookies instead of just having your browser accept them, if you want to handle buttons, text fields, check boxes and more in your web pages, if you want to track users with sessions, or if you want to connect to a database on the server, then look no further. This book lets you take control of the server side of things.

In addition, this book is specially written so that you don't need a lot of experience to use it. Theonly real requirement for this book is familiarity with HTML. You don't need to be an HTML expert, but you'll need to know some. How Is This Book Organized?

This book contains nine chapters:

  • Chapter 1 provides a foundation, getting you started with PHP.

  • Chapter 2 is all about using operators and flow control in PHP to begin handling your data.

  • Chapter 3 handles text strings and organizes data into arrays.

  • Chapter 4 introduces functions, which let you wrap up PHP into manageable _sections that can be called by name.

  • Chapter 5 starts using PHP to work with HTML controls such as text fields and buttons in web pages.

  • Chapter 6 shows how to create web applications in more detail by checking what type of browser the user has, how to check the user's data, and more.

  • Chapter 7 introduces object-oriented programming in PHP and shows how to _handle files on the web server.

  • Chapter 8 discusses something that PHP does well: working with databases on the server. In this chapter, we'll work with MySQL.

  • Chapter 9 covers a number of important web techniques: using cookies, sessions, FTP, email, and more.

  • We have included a bonus chapter on the Web site that shows how to draw graphics interactively on the web server and send them back to the browser. To download this chapter, go to http://www.awprofessional.com/title/0131498622.

All you need to read this book is some knowledge of HTML. You don't need to know anything about server-side programming. You get all the material you need right here.

As far as software goes, we'll be using PHP 5.0, and I'll show you where to download it for free. All you need to do is to download and install the required software (the installations are easy, unlike some larger software packages).

You don't need Internet access to learn PHP from this book. If you want, you can develop and test your PHP pages all on the same computer. However, if you want to put your PHP code on the Internet, you'll need to use an ISP that supports PHP. Check with your ISP to find if they support PHP—more and more ISPs are doing so every day.What's Unusual About This Book?

This book—like other books in the Spring Into... Series—includes the following _elements:

  • Each topic is explained in a discrete one- or two-page unit called a "chunk."

  • Each chunk builds on the previous chunks in that chapter.

  • Most chunks contain one or more examples. I believe that good examples provide the foundation for almost all useful technical documents.

  • Many chunks contain sidebars that provide helpful, ancillary material.

In addition, this book is filled with examples—dozens of them—because seeing a working example is the best way to learn this material. Here are just a few included topics:

  • Reading data from a web page's text fields, radio buttons, check boxes, and list boxes on the server

  • Creating and handling image maps

  • Tracking users with sessions and cookies

  • Writing data to files on the server (such as guest books)

  • Recovering from errors without crashing

  • Connecting to databases on the server

  • Using SQL to work with databases

  • Drawing images on-the-fly and sending them back to the browser

  • Handling strings and arrays

  • Working with the PHP operators

  • Creating functions

  • Creating classes and objects

  • Using FTP from PHP

  • Sending email from PHP

  • Using sessions to preserve data between page accesses

  • The complete PHP syntax

There's a lot to PHP, and there's a lot to this book. Our plan is to cram as much PHP into the book as we can. Where Can You Download Examples Used in This Book?

The code in this book is available for download at http://www.awprofessional.com/springinto. All the code examples have been tested by the author and tech editor on different machines.

This book is designed to be at the top of the PHP field. If you have comments and suggestions for improvements, please write to me, care of Prentice Hall. This book is _designed to be the new standard in PHP programming books, more complete and more accessible than ever before. Please keep in touch with ways to improve it and keep it on _the cutting edge. Thanks. Who Helped Me Write This Book?

A book like this is the work of many people. Besides your local author, Mark L. Taub and Barry Rosenberg helped create and design the book. Matt Wade and Eugenia Harris did excellent reviews of the manuscript.

That's it. We're ready to dig into PHP on Chapter 1.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Table of Contents

Preface.

About the Author.

About the Series Editor.

1. Essential PHP.

Getting PHP.

Setting Up Your Development Environment.

Creating Your First PHP Script.

Running Your First PHP Script.

What If It Doesn’t Work?

Mixing In Some HTML.

How About Printing Out Some Text?

More Printing Power.

Printing “Here” Documents.

Running PHP on the Command Line.

Commenting Your Scripts.

Getting a Handle on Data: Variables.

Assigning Values to Variables.

Interpolating Variables in Strings.

Creating Variable Variables.

Creating Constants.

Handling Data Types.

Summary.

2. Gaining Control with Operators and Flow Control.

The Math Operators.

The Math Functions.

The Assignment Operators.

Incrementing and Decrementing.

Operator Precedence.

The Execution Operator.

String Operators.

Bitwise Operators.

Using if Statements.

The Comparison Operators.

Logical Operators.

Using else Statements.

Using elseif Statements.

The Ternary Operator.

Using switch Statements.

Working with for Loops.

Working with while Loops.

Working with do...while Loops.

Working with foreach Loops.

Breaking Out of Loops.

Skipping Interactions with continue.

Some Alternative Syntax.

Summary.

3. Handling Strings and Arrays.

Listing of String Functions.

Using the String Functions.

Formatting Strings.

Converting to and from Strings.

Creating Arrays.

Modifying Arrays.

Removing Array Elements.

Looping Over Arrays.

Listing of the Array Functions.

Sorting Arrays.

Navigating through Arrays.

Imploding and Exploding Arrays.

Extracting Variables from Arrays.

Merging and Splitting Arrays.

Comparing Arrays.

Manipulating the Data in Arrays.

Creating Multidimensional Arrays.

Looping Over Multidimensional Arrays.

Using the Array Operators.

Summary.

4. Breaking It Up: Functions.

Creating a Function.

Passing Data to Functions.

Passing Arrays to Functions.

Setting Up Default Argument Values.

Passing Arguments by Reference.

Creating Variable-Length Argument Lists.

Returning Values from Functions.

Returning Arrays from Functions.

Returning Lists from Functions.

Returning References from Functions.

Using Variable Scope.

Getting Global Access.

Using Static Variables.

Creating Variable Functions.

Creating Conditional Functions.

Creating Functions within Functions.

Using Include Files.

Handling Errors Returned by Functions.

Summary.

5. Handling HTML Controls in Web Pages.

Handling User Data with Web Forms.

Creating Text Fields.

Retrieving Data from Text Fields.

Creating Text Areas.

Creating Checkboxes.

Creating Radio Buttons.

Creating Listboxes.

Creating Hidden Controls.

Creating Password Controls.

Creating Image Maps.

Uploading Files.

Reading Uploaded Files.

Creating Buttons: Take 1.

Creating Buttons: Take 2.

Creating Buttons: Take 3.

Summary.

6. Creating Web Forms and Validating User Input.

Displaying All a Form’s Data At Once.

Useful Server Variables.

Useful HTTP Headers.

Determining Browser Type with HTTP Headers.

Redirecting Users with HTTP Headers.

Receiving Form Data in Custom Arrays.

Web Applications Using a Single PHP Page.

Validating User Data.

Validating Data: Requiring Data Entry.

Validating Data: Checking for Numbers.

Validating Data: Checking for Strings.

Removing HTML Tags.

Encoding HTML Tags.

Preserving Data.

Using JavaScript to Validate Data.

Using HTTP Authentication.

Summary.

7. Object Oriented Programming and File Handling.

Working with Classes and Objects.

Creating a Class.

Creating an Object.

Restricting Access to Properties and Methods.

Initializing Objects with Constructors.

Basing One Class on Another: Inheritance.

Using Protected Inheritance.

Overriding Methods.

Accessing Base Class Methods.

Opening a File: fopen.

Reading Lines of Text: fgets.

Reading Characters: fgetc.

Binary Reading: fread.

Reading a Whole File: file_get_contents.

Parsing a File: fscanf.

Writing to a File: fwrite.

Appending to a File: fwrite.

Writing the File at Once: file_put_contents.

Summary.

8. Working with Databases.

What Are Databases?

Some Basic SQL.

Setting Up Database Support in PHP.

Creating a Database Using MySQL.

Adding Data to the Database.

Accessing a MySQL Database.

Displaying a Data Table.

Updating Your Data.

Inserting New Data.

Deleting Data.

Creating a New Table.

Creating a Database.

Sorting Data.

Getting the PEAR DB Module.

Displaying a Table with DB.

Inserting New Data with DB.

Updating Data with DB.

Summary.

9. Cookies, Sessions, FTP, Email, and More.

Setting Cookies.

Getting Cookies.

Setting a Cookie’s Expiration Time.

Deleting Cookies.

Using FTP.

FTP: Getting a Directory Listing.

FTP: Downloading a File.

FTP: Uploading a File.

Sending Email.

Sending Email with Headers.

Sending Email with Attachments.

Working with Sessions.

Storing Session Data.

Creating a Hit Counter.

Using Sessions Without Cookies.

Removing Data in Sessions.

Summary.

Appendix A: PHP Language Elements.

Appendix B: PHP Function Reference.

Index.

Read More Show Less

Preface

Preface

Welcome to PHP! This book has been written to be as comprehensive—and as accessible—as a book on PHP can be. It puts the power of PHP to work for you, pushing the envelope as far as it can go. The best way to learn any topic like PHP is by example, and this is an example-oriented book. You'll find dozens of tested examples here, ready to go to work.

PHP is quickly gaining popularity these days. Web page authors are requiring more and more power, and PHP is the answer. Not content to simply handle web pages in browsers any more, people are turning to the server side to do things you just can't do in a browser. Using PHP, you have total control over your web applications—and the good part is that they're not any harder to write than a typical web page.

PHP is an amazing package, and you're getting into it at the right time, when the excitement level is soaring. You'll see more PHP here than in any similar book, doing things you won't see other places, such as drawing images on-the-fly on the server and then sending them back to the browser.

Who Should Read This Book?

This book is for you if you truly want to develop all the power of web applications. If you want to start using cookies instead of just having your browser accept them, if you want to handle buttons, text fields, check boxes and more in your web pages, if you want to track users with sessions, or if you want to connect to a database on the server, then look no further. This book lets you take control of the server side of things.

In addition, this book is specially written so that you don't need a lot of experience to use it. The only real requirement for this book is familiarity with HTML. You don't need to be an HTML expert, but you'll need to know some.

How Is This Book Organized?

This book contains nine chapters:

  • Chapter 1 provides a foundation, getting you started with PHP.
  • Chapter 2 is all about using operators and flow control in PHP to begin handling your data.
  • Chapter 3 handles text strings and organizes data into arrays.
  • Chapter 4 introduces functions, which let you wrap up PHP into manageable _sections that can be called by name.
  • Chapter 5 starts using PHP to work with HTML controls such as text fields and buttons in web pages.
  • Chapter 6 shows how to create web applications in more detail by checking what type of browser the user has, how to check the user's data, and more.
  • Chapter 7 introduces object-oriented programming in PHP and shows how to _handle files on the web server.
  • Chapter 8 discusses something that PHP does well: working with databases on the server. In this chapter, we'll work with MySQL.
  • Chapter 9 covers a number of important web techniques: using cookies, sessions, FTP, email, and more.
  • We have included a bonus chapter on the Web site that shows how to draw graphics interactively on the web server and send them back to the browser. To download this chapter, go to http://www.awprofessional.com/title/0131498622.

All you need to read this book is some knowledge of HTML. You don't need to know anything about server-side programming. You get all the material you need right here.

As far as software goes, we'll be using PHP 5.0, and I'll show you where to download it for free. All you need to do is to download and install the required software (the installations are easy, unlike some larger software packages).

You don't need Internet access to learn PHP from this book. If you want, you can develop and test your PHP pages all on the same computer. However, if you want to put your PHP code on the Internet, you'll need to use an ISP that supports PHP. Check with your ISP to find if they support PHP—more and more ISPs are doing so every day.

What's Unusual About This Book?

This book—like other books in the Spring Into... Series—includes the following _elements:

  • Each topic is explained in a discrete one- or two-page unit called a "chunk."
  • Each chunk builds on the previous chunks in that chapter.
  • Most chunks contain one or more examples. I believe that good examples provide the foundation for almost all useful technical documents.
  • Many chunks contain sidebars that provide helpful, ancillary material.

In addition, this book is filled with examples—dozens of them—because seeing a working example is the best way to learn this material. Here are just a few included topics:

  • Reading data from a web page's text fields, radio buttons, check boxes, and list boxes on the server
  • Creating and handling image maps
  • Tracking users with sessions and cookies
  • Writing data to files on the server (such as guest books)
  • Recovering from errors without crashing
  • Connecting to databases on the server
  • Using SQL to work with databases
  • Drawing images on-the-fly and sending them back to the browser
  • Handling strings and arrays
  • Working with the PHP operators
  • Creating functions
  • Creating classes and objects
  • Using FTP from PHP
  • Sending email from PHP
  • Using sessions to preserve data between page accesses
  • The complete PHP syntax

There's a lot to PHP, and there's a lot to this book. Our plan is to cram as much PHP into the book as we can.

Where Can You Download Examples Used in This Book?

The code in this book is available for download at http://www.awprofessional.com/springinto. All the code examples have been tested by the author and tech editor on different machines.

This book is designed to be at the top of the PHP field. If you have comments and suggestions for improvements, please write to me, care of Prentice Hall. This book is _designed to be the new standard in PHP programming books, more complete and more accessible than ever before. Please keep in touch with ways to improve it and keep it on _the cutting edge. Thanks.

Who Helped Me Write This Book?

A book like this is the work of many people. Besides your local author, Mark L. Taub and Barry Rosenberg helped create and design the book. Matt Wade and Eugenia Harris did excellent reviews of the manuscript.

That's it. We're ready to dig into PHP on Chapter 1.

© Copyright Pearson Education. All rights reserved.

Read More Show Less

Customer Reviews

Average Rating 4
( 1 )
Rating Distribution

5 Star

(0)

4 Star

(1)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted April 29, 2005

    quick learning

    An experienced programmer who does not know PHP 5 should be able to use this book to get up to speed within a few days. Holzner presents a concise and logical unfolding of PHP, and without taking 1000 pages to do so. The first 4 chapters are about using the basic syntax. Much the same as several other languages like C or C++. The if-else and switch statements will look similar to what you're already used to, for example. There are the open and closing notations for a code block to get used to. But this is pretty simple. The real point to the language is given in later chapters, on handling HTML in web pages and making forms and being able to validate these. Here, you really need prior acquaintance with web servers and HTML, to fully appreciate what Holzner explains about PHP. He also gives more advanced usages. Where PHP can be written in an object oriented manner. A relatively recent thing in PHP. Also, he shows how to hook up PHP to a back end relational database. For the latter, he chooses MySQL. But Postgresql or any other RDB could probably also do just as well.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)