PHP for Web Designers
5h 27mBeginner2013-12-09
Authors

David Powers
Developing websites since 1994
Course details
There are many great reasons to learn PHP. You can reduce manual updates to webpages, get user input, and connect to a database of products or other information. But some web designers are intimidated by the theory and jargon. PHP for Web Designers is different. Author David Powers provides a gentle introduction to PHP, through a series of simple exercises that help you develop fully functional dynamic webpages—all powered by PHP. Learn how to reduce website maintenance by moving common page elements to external server-side include files, change content automatically depending on the date or time, display alternate text, gather user input from a form, and link to a database to display product information. The final chapter is dedicated to understanding error messages and fixing their root causes.
Note: This course was recorded with Adobe Dreamweaver, but you can use the code editor of your choice to follow along.
Learning objectives
How to use PHP in a webpage
Storing and displaying text and numbers in variables
Using functions
Adding comments to your PHP scripts
Moving common page elements to include files
Displaying different content on a page
Working with multiple values in arrays and loops
Getting form input sent by the POST method
Using PHP sessions to preserve data
Storing data in session variables
Connecting to and querying a database
Handling errors
Note: This course was recorded with Adobe Dreamweaver, but you can use the code editor of your choice to follow along.
Learning objectives
How to use PHP in a webpage
Storing and displaying text and numbers in variables
Using functions
Adding comments to your PHP scripts
Moving common page elements to include files
Displaying different content on a page
Working with multiple values in arrays and loops
Getting form input sent by the POST method
Using PHP sessions to preserve data
Storing data in session variables
Connecting to and querying a database
Handling errors
Skills covered
PHPPersonaProgramming LanguagesOpen SourceSoftware Development
Concepts
Introduction
- Welcome
- What you should know before watching this course
- Using the exercise files
- Configuring MAMP to show errors (Mac)
Introduction to PHP
- How PHP makes web pages dynamic
- How to use PHP in a web page
- Using variables to store information
- Storing numbers and text in variables
- Displaying the values of number and text variables
- Using functions to manipulate values
- Adding comments to PHP scripts
Using Server-Side Includes for Common Page Elements
- What are server-side includes
- Deciding which include command to use
- Challenge - Moving common elements to include files
- Solution - Moving common elements to include files
- Making sure internal links still work in an include file
Using Conditions to Change Page Output
- How PHP makes decisions
- Changing output depending on the current time
- Adjusting the server's time zone
- Displaying an up-to-date copyright notice
- Challenge - Displaying an image of the month
- Solution - Displaying an image of the month
- Understanding what PHP treats as true and false
Working with Multiple Values in Arrays and Loops
- Storing multiple values in a variable as an array
- Inspecting an array's elements
- Challenge - Inserting the appropriate alt text
- Solution - Inserting the appropriate alt text
- Displaying an array as a comma-separated list
- Looping through an array's values
- Labeling array elements
- Looping through an array's labels and values
- Finding if a value exists in an array
- Challenge - Displaying a seasonal feature
- Solution - Displaying a seasonal feature
Getting User Input from a Form
- Getting form input sent by the POST method
- Retrieving values from a URL's query string
- Challenge - Plan the order form
- Solution - Plan the order form
- Finding and extracting a substring
- Organizing the form data into arrays
- Using a loop to build a table for the data
- Controlling which rows are displayed
- Creating a custom function to extract part of a file name
- Calculating the order total
- Using PHP sessions to preserve data
- Storing data in session variables
- Ending the PHP session and deleting the data
Displaying Content from a Database
- Loading data into MySQL
- Connecting to the database
- Querying the database
- Displaying the results of the query
- Using modulo division to establish a repeating series
- Repeating output at specific intervals in a loop
- Linking to a details page
- Embedding a variable in a query securely
- Handling database errors gracefully--and securely
Handling Errors
- Dealing with PHP errors
- Why is my page blank or incomplete
- Tracking down parse errors
- What to do with failed to open stream
- What does headers already sent mean
- What does undefined index, variable, or constant mean
- What on earth is T ENCAPSED AND WHITESPACE
Conclusion
- What's next