LESSON 6 Flashcards
In PHP, there are two methods to handle form submissions:
Each method has its advantages and disadvantages, so it is crucial to choose the
appropriate one based on your needs.
GET and POST
These two are what we also call _. The are special types of variables because they can be accessed from any scope.
Superglobals
visible to everyone (all variable
names and values are displayed in the URL)
length restriction of GET method is
limited (about 2000 characters)
retrieve data from the address bar
GET
not visible in query parameters
no restriction
to securely pass sensitive and
confidential information
POST
function checks whether a variable is set, which means that it has to be declared and is not NULL. Look at the example at the right.
isset()
is a “technical process where a web-form checks if the information provided by a user is correct.”
Form validation
Some examples of validation rules are:
Name
Contact Number
Email
Gender
Status
Required. Must only contain letters,
numbers, and spaces.
Name
Required/Optional. Must only contain numbers.
Contact Number
Required/Optional. Must contain a
valid email address.
Required/Optional. Must only
choose one.
Gender
Required/Optional. Must only
choose one.
Status
Function which will tell you whether a string matches the pattern.
preg_match()
to validate email in PHP.
filter_var()
FILTER_VALIDATE_EMAIL