PHP Session

A session is a frame of communication between two mediums. PHP sessions are used to temporarily store and transmit information from one page to another (until the user close the website). Problem:  The HTTP address does not keep state, So the web server has no idea who you are or what you do. Solution: Session variables … Read more

PHP Form Handling

Form data is collected using the PHP superglobals $_GET and $_POST. PHP Form Handling-Simple HTML Form A simple HTML form with two input boxes and a submit button is shown below: In the above example, when a user fills out the form and clicks the submit button, the information is transferred to a PHP file … Read more

PHP Cookie

A PHP cookie is a tiny file that the web server saves on the client computer, with a maximum size of 4KB. The cookie will be sent each time the same computer requests a page through a browser. They are often used to store track of information like a username that the site can use to … Read more

PHP Regular Expressions

Regular expressions are nothing more than a string of characters in a particular order. Regular Expressions (“regex” or “RegExp”) are specifically designed text strings that are used to find patterns in text. To generate complex expressions, regular expressions use arithmetic operators like (+,-,). They may assist you with activities such as validating email addresses and … Read more

PHP Superglobal Variables

As we have discussed PHP Global variables. Some PHP variables are “superglobals,” which means they are always reachable, irrespective of scope, and can be accessed from any function, class, or file without doing anything special. PHP Superglobal Variables The superglobals can be found all across your script. These variables can be accessed from any function, … Read more

PHP Complete Form

Php Complete form example will be shown in this chapter: Let’s look at how to maintain input field data saved even after the form has been submitted. PHP Complete Form-Keep field value We add a small PHP script inside the value attribute of the following input fields: name, email, and website, to show the values … Read more

PHP Forms – Field Validation

The validation of form fields is demonstrated in this chapter. Let’s have a look at the form fields we’ll be creating. Field Validation Rules Name Must only contain letters and whitespace E-mail Must contain a valid email address (with @ and .) Website It must contain a valid URL We discussed required fields and errors … Read more

PHP Associative Array

In terms of functionality, associative arrays are fairly similar to numeric arrays, however, they differ in terms of the index. The index of an associative array will be a string, allowing you to create a strong link between key and value. PHP Associative Array Definition There are two ways of defining PHP associative array: 1. … Read more

Categories PHP

PHP Form Validation

PHP Form Validation is the process of verifying the user’s input. In PHP, there are two forms of validation. The following is a list of them: Client-Side Validation: It is used for field validation and is performed on client machine web browsers. Server-Side Validation: After form submission, data is forwarded to a server, which performs validation checks. … Read more

PHP Form Required Fields

This chapter explains how to make input fields required and, if necessary, provide error messages. PHP Form Required Fields Let’s look at a PHP for fields, some of which cannot be left blank and must be filled out: Field Validation Rules Name Required+ It can only contain letters and whitespaces. E-mail Required. + Must contain a … Read more