3. Send results back as HTML/CSS/JS (Client side languages)
Accessing form variables from within PHP
1. Submit form to server
2. Run PHP script; pass in form data
3. Pass back HTML to client
GET
Default method. If the request has parameters, they are sent in the URL as a query string
POST
If the request has parameters, they are embedded in the request's HTTP packet, not the URL
Superglobal associative arrays
$_REQUEST, $_GET, $_POST
$_SERVER
$_SESSION, $_COOKIE
$_FILES
PHP Form Validation – Server Side Validation
1. Empty String
2. Validate String
3. Validate Numbers
4. Validate Email
5. Validate URL
6. Input length
Linking to other files in PHP
We reference our CSS and JavaScript files in our HTML output via the link and script tags.<|>We reference content we want to link to or allow a user to view/download, we achieve this via body-level anchor tags.
Linking to other PHP files
Other PHP files can also be included easily using __DIR__ to obtain the current code working directory
Content Delivery Networks (CDNs)
It is becoming increasingly common to store these files on a different server. These are known as Content Delivery Networks (CDN).
HereDoc
Use the HereDoc syntax to delimit strings in PHP. This can allow you to mix larger sections of HTML inside your PHP code.