Summary
Highlights
Understand the differences between GET and POST superglobal variables for collecting data from HTML forms. This section highlights security considerations, data limits, and appropriate use cases for each method, illustrated with a practical order form example.
Discover several built-in mathematical functions in PHP like `abs()`, `round()`, `floor()`, `ceil()`, `pow()`, `sqrt()`, `max()`, `min()`, `pi()`, and `rand()`. The section includes an exercise to calculate circumference, area, and volume of a circle/sphere based on user input.
This section introduces PHP as a server-side scripting language used for dynamic web pages, running on 70% of known websites. It covers PHP's history, its mascot, and its basic request-response cycle with servers and databases. It also recommends XAMPP for a local server environment and VS Code as a text editor.
This part details the installation process for XAMPP to create a local server space for executing PHP code, including setting up Apache and MySQL services. It also guides through installing VS Code, configuring PHP validation, and recommending essential VS Code extensions for PHP development.
Learn how to display output using 'echo' and add line breaks in PHP. This section also covers single-line and multi-line comments for code documentation and demonstrates how to embed HTML within PHP files.
Explore PHP variables as reusable containers for data. This segment dives into different data types: strings, integers, floats, and booleans, providing examples for each and showing how to perform basic operations like concatenation and calculations with them.
This part covers fundamental arithmetic operators in PHP including addition, subtraction, multiplication, division, exponentiation, and modulus. It also explains increment/decrement operators and the importance of operator precedence in complex expressions.
This section explains logical operators (AND, OR, NOT) for combining multiple conditions in PHP. It provides examples of using these operators for weather checks, voting eligibility, and movie ticket pricing, emphasizing their role in complex decision-making.
Find out how switch statements offer a more efficient alternative to multiple else if conditions. Examples include mapping letter grades to messages and displaying custom messages based on the current day of the week, demonstrating how to use cases and a default option.
Master for loops for repeating code a fixed number of times. This part explains the three optional statements within a for loop (initialization, condition, increment/decrement) and includes exercises for counting up and down from a user-specified number.
Learn about while loops for repeating code as long as a condition remains true. The section contrasts while loops with for loops, emphasizing their use for potentially infinite iterations, and illustrates with an example of a stopwatch that can be stopped by user input.
This part covers arrays as special variables holding multiple values. It demonstrates how to declare arrays, access elements by index, iterate using `foreach` loops, and manipulate arrays with functions like `array_push()`, `array_pop()`, `array_shift()`, `array_reverse()`, and `count()`.
Explore associative arrays where each element is a key-value pair. Practical examples include mapping countries to capitals. This section covers indexing by key, iterating with `foreach`, updating and adding pairs, and using functions like `array_keys()`, `array_values()`, `array_flip()`, and `count()`.
Understand the `isset()` and `empty()` functions for checking variable states and user input. This segment explains when each function returns true or false and applies them to validate input fields in an HTML login form, emphasizing their role in robust form handling.
Learn to manage radio buttons in PHP by retrieving selected values from an HTML form. This part covers creating radio button groups, using the `$_POST` superglobal to get the selected value, and processing the choice with if-else statements or switch cases.
This section explains how to handle checkboxes in PHP forms. It demonstrates how to check if individual checkboxes are selected using `isset()` or `empty()` functions, and how to group multiple checkboxes into an array for easier processing using a `foreach` loop.
Discover how to create and use functions in PHP for reusable code. This part covers defining functions, passing arguments through parameters, returning values, and type hinting for parameters. Examples include singing 'Happy Birthday' and calculating a hypotenuse.
Explore a variety of useful string manipulation functions in PHP, such as `strtolower()`, `strtoupper()`, `trim()`, `str_pad()`, `str_replace()`, `strrev()`, `str_shuffle()`, `strcmp()`, `strlen()`, `strpos()`, `substr()`, `explode()`, and `implode()`.
Learn critical techniques for securing PHP applications by sanitizing and validating user input. This section covers functions like `filter_input()` with various filters (`FILTER_SANITIZE_SPECIAL_CHARS`, `FILTER_SANITIZE_NUMBER_INT`, `FILTER_VALIDATE_EMAIL`, `FILTER_VALIDATE_INT`) to prevent malicious attacks and ensure data integrity.
Understand the `include()` function for copying content from one PHP file into another. This part highlights the benefits of code reusability and maintainability by structuring websites with reusable components like headers and footers.
This section introduces cookies as small pieces of information stored in a user's web browser. It covers how to create, read, and delete cookies using `setcookie()` and how to access them via the `$_COOKIE` superglobal variable, illustrating their use for browsing preferences and targeted ads.
Learn about sessions as a way to store user information across multiple pages, essential for login systems. This part explains `session_start()`, `$_SESSION` superglobal, creating login and home pages with session management, and `session_destroy()`.
Explore the `$_SERVER` superglobal variable, which contains server-related information like headers, paths, and script locations. This section demonstrates practical uses for `$_SERVER['PHP_SELF']` to dynamically set form actions and `$_SERVER['REQUEST_METHOD']` to check submission types, emphasizing security considerations with `HTMLspecialchars()`.
Discover hashing as a process to transform sensitive data like passwords into a secure, irreversible format. This part explains `password_hash()` for creating hashes and `password_verify()` for comparing plain-text passwords with hashes, crucial for protecting user data in databases.
This critical section guides through connecting PHP to a MySQL database using the MySQLi extension. It covers setting up a database in phpMyAdmin, configuring connection variables, and handling connection errors gracefully with try-catch blocks.
Learn how to create tables within your MySQL database using phpMyAdmin. This part covers defining columns, setting data types, establishing primary keys, enabling auto-increment, and ensuring uniqueness for fields like usernames.
This section demonstrates how to insert data into a MySQL table using PHP. It covers writing SQL INSERT queries, executing them with `mysqli_query()`, and securely storing passwords by hashing them before insertion, along with basic error handling for duplicate entries.
Learn to retrieve data from a MySQL database using PHP. This part explains how to write SQL SELECT queries, execute them, and fetch results as associative arrays using `mysqli_fetch_assoc()`. It also shows how to handle single or multiple rows using loops.
This final project integrates many concepts to build a complete user registration form. It covers form creation, sanitizing and validating user input, hashing passwords, inserting data into a MySQL database, and handling potential errors like duplicate usernames gracefully.
Learn how to control program flow using if, else if, and else statements. This part demonstrates conditional logic (e.g., age verification, Boolean checks) and includes an exercise to calculate weekly pay with overtime.