PHP TUTORIALPHP TutorialPHP InstallationPHP Hello WorldPHP Basic SyntaxPHP CommentsPHP VariablesPHP Variable ScopePHP ConstantsPHP StringsPHP OutputPHP Data TypesPHP Type CastingPHP OperatorsPHP ConditionalsPHP Shorthand ConditionalsPHP LoopsPHP Loop Control StructuresPHP FunctionsPHP String FunctionsPHP ArraysPHP Superglobal VariablesPHP in HTMLPHP AdvancedPHP Include and RequirePHP RegexRegex IntroductionRegex PCRE SyntaxPHP PREG FunctionsPHP FormsPHP Forms IntroductionPHP Forms CreatingPHP Forms SecurityPHP Forms ValidationPHP Forms Required InputsPHP Forms StickyPHP Forms Advanced ValidationPHP Forms FinishingPHP OOPPHP OOP IntroductionPHP OOP ClassesPHP OOP PropertiesPHP OOP ObjectsPHP OOP MethodsPHP OOP $this KeywordPHP OOP Constructors and DestructorsPHP OOP VisibilityPHP OOP InheritancePHP OOP Abstract Classes and MethodsPHP OOP InterfacesPHP OOP TraitsPHP OOP ConstantsPHP OOP StaticPHP OOP Namespaces

PHP Forms Introduction

Forms are used to collect data from the users

What Are Forms?

Using HTML, we can use input fields, text areas, check boxes, radio buttons to get user inputs. Then, we can submit the user input to the server and process them.

In web development, handling a HTML form is perhaps the most important process. Two steps are involved:

Where Are Forms Used?

Almost every website has forms. Including,

Forms are really handy when creating dynamic websites.

Form Methods

There are two main methods that forms work with.

When, you open a link in your browser, browser uses GET method by default. In both methods, key/value pair data can be sent.


Data is sent in the URL.Data is sent in the body of the HTTP request.
Request can be cached and saved in the browser history.Request cannot be cached and saved in the browser history.
Never used to work with sensitive data (ex: email, passwords).Used to work with sensitive data.
Used to get or fetch data.Used to send data.
Have some length restrictions.No length restriction.

Form Handling with PHP

PHP is very powerful in handling HTML forms. Its built-in functions makes form validation easy and secure. Continue to the next chapter to learn about PHP forms, step-by-step.

Facebook Twitter