Conditional processing allows programmers to execute different code based on specific conditions. There are two conditional structures in PHP - if - elseif - else and switch / case. There is also a special operator called the ternary operator for short conditional expressions.
There are a few different ways of working with databases in PHP, but the most common two are through extensions that ship as part of PHP: the MySQL Improved (mysqli) extension and the PHP Data Objects (PDO) extension. They work in much the same way. In this course, we will teach the PDO extension as it can be used with any database; whereas mysqli just works with MySQL. We will start the lesson with an overview of objects and classes as it's important to understand a bit about object-oriented programming to work with PDO.
Like most programming languages, PHP throws exceptions (i.e., reports an error with detailed information) when something goes wrong. The programmer can anticipate, catch, and handle those exceptions in the code.
A common way to pass data from one page to another is through HTML forms. There are two methods of submitting data through a form: the get method and the post method. In this lesson, you will learn to use both.
In this lesson, we show you how to use PHP's built-in mail() function, and then show you how to use PHPMailer, an excellent email extension, which provides more features than the built-in mail() function.
This lesson consists of four exercises:
Creating a page to submit a new poem.
Modifying the poems page so that it shows all the current user's poems, even those not yet approved.
Creating a page to edit an existing poem.
Creating a page to delete a poem.
This lesson has no final quiz.