- Create
index.php
- Comments
// /* */
echo
Command- Variables
- Strings
- Concatenation
- Arrays
- Indexed
- Associative
- Multi-dimensional
include_once
vsrequire_once()
- Control structures
for
if
==
vs=
- Functions
Challenge: Create a 3 page website (about.php
, index.php
, contact.php
) whose navigation and page content is fed by arrays; use functions to access the arrays and echo the content. You will need: content.php
, functions.php
, and nav.php
files
- Make a backup of your Vagrant file
$ mv Vagrantfile Vagrantfile.log
- Download Vagrantfile from the repo to your local
php-training
folder (or copy-paste to an emptyVagrantfile
- click on file, view "raw", then file/save) - Create a basic form on the
contact.php
page (firstname, lastname, submit) - Use
$_POST/$_GET
to pull data into the index.php - Use "Null Coalescing"
??
operators to set default value of variable from$_POST
Challenge: Split into teams of 2 and, on the White boards, write out a basic HTML page that uses PHP to set a name variable before the HTML and then echo out that variable in the body of the HTML.
Challenge: Same teams, on the white boards, before your HTML use php to set two names with an array and then use a loop in the body of the HTML to echo each name out in <p>
tags.
Challenge: Use PHP to get the first and last name variables from $_POST
and echo them out as the default content for the two first and last name fields in the form.
- Enable PHP Error Reporting
- Databases (what are they? how do they even work?)
- MySQL
- Log in to mysql locally
- Show Databases
- Show Tables
- Describe tables
- Select data
- Create a database
- Create a table
- Insert rows
- MySQL
- Connect to database in PHP