Tag php

PHP Forms – Required Fields

This chapter shows how to make input fields required and create error messages if needed PHP – Required Fields From the validation rules table on the previous page, we see that the “Name”, “E-mail”, and “Gender” fields are required. These…

PHP Form Validation

This and the next chapters show how to use PHP to validate form data. PHP Form Validation   Think SECURITY when processing PHP forms! These pages will show how to process PHP forms with security in mind. Proper validation of…

PHP Form Handling

The PHP superglobals $_GET and $_POST are used to collect form-data. PHP – A Simple HTML Form The example below displays a simple HTML form with two input fields and a submit button: Example <html> <body> <form action=”welcome.php” method=”POST”> Name:…

PHP Regular Expressions

What is a Regular Expression? A regular expression is a sequence of characters that forms a search pattern. When you search for data in a text, you can use this search pattern to describe what you are searching for. A…

PHP – $_GET

PHP $_GET $_GET contains an array of variables received via the HTTP GET method. There are two main ways to send variables via the HTTP GET method: Query strings in the URL HTML Forms Query string in the URL A…

PHP – $_POST

PHP $_POST $_POST contains an array of variables received via the HTTP POST method. There are two main ways to send variables via the HTTP Post method: HTML forms JavaScript HTTP requests

PHP – $_REQUEST

$_REQUEST $_REQUEST is a PHP super global variable which contains submitted form data, and all cookie data. In other words, $_REQUEST is an array containing data from $_GET, $_POST, and $_COOKIE. You can access this data with the $_REQUEST keyword…

PHP – $_SERVER

$_SERVER $_SERVER is a PHP super global variable which holds information about headers, paths, and script locations. The example below shows how to use some of the elements in $_SERVER: Example echo $_SERVER[‘PHP_SELF’]; echo $_SERVER[‘SERVER_NAME’]; echo $_SERVER[‘HTTP_HOST’]; echo $_SERVER[‘HTTP_REFERER’]; echo…

PHP $GLOBALS

$GLOBALS is an array that contains all global variables. Global Variables Global variables are variables that can be accessed from any scope. Variables of the outer most scope are automatically global variables, and can be used by any scope, e.g.…