Save
Mobile & Web Development
Week2
Save
Share
Learn
Content
Leaderboard
Share
Learn
Created by
Khin Htet Htet Htar
Visit profile
Cards (15)
Request Handling in PHP
1.
Forms
2.
Client-server
architecture
3.
HTML
Input Elements
4.
Outlines
View source
Request Handling in PHP
Forms and
client server
architecture
View source
HTML Form Input Types
text
button
checkbox
file
hidden
image
password
radio
submit
View source
HTML5 Form Input Types
color
date
datetime-local
email
month
number
range
search
tel
time
url
week
View source
Client-Server data passing
1. HTML
Form
Page displayed to user
2. Pass data to
PHP
script and interpret it
3. Send results back as
HTML
/
CSS
/JS (Client side languages)
View source
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
View source
GET
Default method. If the request has
parameters
, they are sent in the URL as a
query string
View source
POST
If the request has parameters, they are embedded in the request's HTTP
packet
, not the
URL
View source
Superglobal associative arrays
$_REQUEST, $_
GET
, $_
POST
$_
SERVER
$_SESSION, $_
COOKIE
$_FILES
View source
PHP Form Validation – Server Side Validation
1.
Empty String
2.
Validate
String
3. Validate
Numbers
4.
Validate Email
5.
Validate URL
6.
Input length
View source
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.
View source
Linking to other PHP files
Other
PHP files
can also be included easily using __DIR__ to obtain the current code working directory
View source
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).
View source
HereDoc
Use the HereDoc syntax to delimit strings in
PHP.
This can allow you to mix larger sections of HTML inside your
PHP
code.
View source
Null
coalescing
operator
View source