SlideShare a Scribd company logo
Form handling in php
 $_GET
 $_POST
 $_REQUEST
2
 HTML forms are used to pass data to a server via different input controls.
 All input controls are placed in between <form> and </form>
Syntax
<form action=“PagetoOpen ” method=“ ” >
//input controls placed here
</form>
Method= GET or POST
3
4
5
<form method="post" action="" >
First Name <input name="fname" type="text" /> <br />
Last Name <input name="lname" type="text" /> <br />
<input type="submit" value="Save" />
</form>
The GET Method
 The GET method sends the encoded user information appended to the page request.
The page and the encoded information are separated by the ? character.
 The GET method is restricted to send upto 1024 characters only.
 Never use GET method if you have password or other sensitive information to be sent
to the server.
 GET can't be used to send binary data, like images or word documents, to the server.
7
POST Method
 The POST method does not have any restriction on data size to be sent.
 The POST method can be used to send ASCII as well as binary data.
 The data sent by POST method goes through HTTP header so security depends on
HTTP protocol. By using this method your information is secure.
 The predefined $_GET Variable use to collect values in a form with method=“get”
information sent from a form with the GET method is visible to everyone (it will be
displayed in the browser address bar ) and has limits on the amount of information
to send.
 $_GET Variable to collect form data ( the name of the form field will automatically
be the keys in the $_GET array )
 $_GET[“name”];
 $_GET[“fname”];
 $_GET[“age”];
8
 The predefined $_POST Variable use to collect values in a form with
method=“post” information sent from a form with the POST method is invisible to
other and has no limits on the amount of information to send.
 Note: there is an 8MB max size for the POST Method , by default (can be changed
by setting the post_max_size in the php.ini file )
 $_POST Variable to collect form data ( the name of the form field will automatically
be the keys in the $_POST array )
 $_POST[“name”];
 $_POST[“fname”];
 $_POST[“age”];
9
 The PHP $_REQUEST variable contains the contents of both $_GET,
$_POST, and $_COOKIE.We will discuss $_COOKIE variable when
we will explain about cookies.
 The PHP $_REQUEST variable can be used to get the result from form
data sent with both the GET and POST methods.
 $_REQUEST[“name”];
 $_REQUEST[“fname”];
 $_REQUEST[“age”];
10
 Both GET and POST create an array (e.g. array( key => value, key2 =>
value2, key3 => value3, ...)).This array holds key/value pairs, where keys
are the names of the form controls and values are the input data from the
user.
 Both GET and POST are treated as $_GET and $_POST.These are
superglobals, which means that they are always accessible, regardless of
scope - and you can access them from any function, class or file without
having to do anything special.
 $_GET is an array of variables passed to the current script via the URL
parameters.
 $_POST is an array of variables passed to the current script via the HTTP
POST method. 11
 Information sent from a form with the GET method is visible to
everyone (all variable names and values are displayed in the URL).
GET also has limits on the amount of information to send.The
limitation is about 2000 characters. However, because the variables
are displayed in the URL, it is possible to bookmark the page.This
can be useful in some cases.
 GET may be used for sending non-sensitive data.
 Note: GET should NEVER be used for sending passwords or other
sensitive information!
12
 Information sent from a form with the POST method is invisible to
others (all names/values are embedded within the body of the HTTP
request) and has no limits on the amount of information to send.
 Moreover POST supports advanced functionality such as support for
multi-part binary input while uploading files to server.
 However, because the variables are not displayed in the URL, it is not
possible to bookmark the page.
13

More Related Content

PPTX
Form Handling using PHP
PPT
Lecture7 form processing by okello erick
PDF
Web app development_php_07
PDF
Making web forms using php
PPTX
MySql:Exporting And Importing Data In Mysql
ODP
Php File Upload
PPT
Chapter 07 php forms handling
PPTX
Uploading a file with php
Form Handling using PHP
Lecture7 form processing by okello erick
Web app development_php_07
Making web forms using php
MySql:Exporting And Importing Data In Mysql
Php File Upload
Chapter 07 php forms handling
Uploading a file with php

What's hot (19)

PPTX
Image upload in php MySql
PPT
File Upload
PPTX
File Uploading in PHP
ODP
Form Processing In Php
PPTX
File upload php
PPT
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
PDF
phptut4
PDF
Introduction to php database connectivity
PDF
03 the htm_lforms
PPTX
MongoDB - Features and Operations
PPTX
Simple xml in .net
DOCX
Php mysql connectivity
PPT
Database presentation
PPTX
Synapse india basic php development part 1
PPT
05 File Handling Upload Mysql
PDF
File handling in qbasic
PPTX
Files in php
Image upload in php MySql
File Upload
File Uploading in PHP
Form Processing In Php
File upload php
PHP and MySQL PHP Written as a set of CGI binaries in C in ...
phptut4
Introduction to php database connectivity
03 the htm_lforms
MongoDB - Features and Operations
Simple xml in .net
Php mysql connectivity
Database presentation
Synapse india basic php development part 1
05 File Handling Upload Mysql
File handling in qbasic
Files in php
Ad

Similar to Form handling in php (20)

PDF
GET and POST in PHP
PPTX
Unit - III.pptxbgffhjxfjdfjfgjnsnsnshdhsjsksjsjsjsjsjsjsjsjsldksk
PPTX
5. Formshcfsjhfajkjsfjsjfjksafjsfjkjfhjsafjsajkgfjskafkjas.pptx
PPTX
Web Techniques like Cookies and Sessions
PDF
web2_lec6.pdf
PDF
PHP-Part4
PDF
PHP Making Web Forms
PPTX
PPTX
Web Application Development using PHP Chapter 5
PPTX
A179178417_21_2025_PHP Get and Post.pptx
PPTX
Get and post methods in php - phpgurukul
PPTX
forms.pptx
PPTX
Chapter 1.Web Techniques_Notes.pptx
PPTX
Session,cookies and get and post methods
PPTX
Working with data.pptx
PDF
How to Build a Web App (for Non-Programmers)
PDF
Noah Brier: How to build web apps
PPTX
Session and cookies ,get and post methods
ODP
PHP BASIC PRESENTATION
GET and POST in PHP
Unit - III.pptxbgffhjxfjdfjfgjnsnsnshdhsjsksjsjsjsjsjsjsjsjsldksk
5. Formshcfsjhfajkjsfjsjfjksafjsfjkjfhjsafjsajkgfjskafkjas.pptx
Web Techniques like Cookies and Sessions
web2_lec6.pdf
PHP-Part4
PHP Making Web Forms
Web Application Development using PHP Chapter 5
A179178417_21_2025_PHP Get and Post.pptx
Get and post methods in php - phpgurukul
forms.pptx
Chapter 1.Web Techniques_Notes.pptx
Session,cookies and get and post methods
Working with data.pptx
How to Build a Web App (for Non-Programmers)
Noah Brier: How to build web apps
Session and cookies ,get and post methods
PHP BASIC PRESENTATION
Ad

Recently uploaded (20)

PPTX
Introduction to Artificial Intelligence
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
How to Choose the Most Effective Social Media Agency in Bangalore.pdf
PPTX
Mastering-Cybersecurity-The-Crucial-Role-of-Antivirus-Support-Services.pptx
PPTX
AIRLINE PRICE API | FLIGHT API COST |
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Jenkins: An open-source automation server powering CI/CD Automation
PDF
Become an Agentblazer Champion Challenge
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
PTS Company Brochure 2025 (1).pdf.......
PPT
JAVA ppt tutorial basics to learn java programming
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
PDF
Best Practices for Rolling Out Competency Management Software.pdf
PDF
System and Network Administraation Chapter 3
PDF
top salesforce developer skills in 2025.pdf
Introduction to Artificial Intelligence
How Creative Agencies Leverage Project Management Software.pdf
How to Choose the Most Effective Social Media Agency in Bangalore.pdf
Mastering-Cybersecurity-The-Crucial-Role-of-Antivirus-Support-Services.pptx
AIRLINE PRICE API | FLIGHT API COST |
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Jenkins: An open-source automation server powering CI/CD Automation
Become an Agentblazer Champion Challenge
How to Migrate SBCGlobal Email to Yahoo Easily
PTS Company Brochure 2025 (1).pdf.......
JAVA ppt tutorial basics to learn java programming
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
A REACT POMODORO TIMER WEB APPLICATION.pdf
Digital Strategies for Manufacturing Companies
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Multi-factor Authentication (MFA) requirement for Microsoft 365 Admin Center_...
Best Practices for Rolling Out Competency Management Software.pdf
System and Network Administraation Chapter 3
top salesforce developer skills in 2025.pdf

Form handling in php

  • 3.  HTML forms are used to pass data to a server via different input controls.  All input controls are placed in between <form> and </form> Syntax <form action=“PagetoOpen ” method=“ ” > //input controls placed here </form> Method= GET or POST 3
  • 4. 4
  • 5. 5 <form method="post" action="" > First Name <input name="fname" type="text" /> <br /> Last Name <input name="lname" type="text" /> <br /> <input type="submit" value="Save" /> </form>
  • 6. The GET Method  The GET method sends the encoded user information appended to the page request. The page and the encoded information are separated by the ? character.  The GET method is restricted to send upto 1024 characters only.  Never use GET method if you have password or other sensitive information to be sent to the server.  GET can't be used to send binary data, like images or word documents, to the server.
  • 7. 7 POST Method  The POST method does not have any restriction on data size to be sent.  The POST method can be used to send ASCII as well as binary data.  The data sent by POST method goes through HTTP header so security depends on HTTP protocol. By using this method your information is secure.
  • 8.  The predefined $_GET Variable use to collect values in a form with method=“get” information sent from a form with the GET method is visible to everyone (it will be displayed in the browser address bar ) and has limits on the amount of information to send.  $_GET Variable to collect form data ( the name of the form field will automatically be the keys in the $_GET array )  $_GET[“name”];  $_GET[“fname”];  $_GET[“age”]; 8
  • 9.  The predefined $_POST Variable use to collect values in a form with method=“post” information sent from a form with the POST method is invisible to other and has no limits on the amount of information to send.  Note: there is an 8MB max size for the POST Method , by default (can be changed by setting the post_max_size in the php.ini file )  $_POST Variable to collect form data ( the name of the form field will automatically be the keys in the $_POST array )  $_POST[“name”];  $_POST[“fname”];  $_POST[“age”]; 9
  • 10.  The PHP $_REQUEST variable contains the contents of both $_GET, $_POST, and $_COOKIE.We will discuss $_COOKIE variable when we will explain about cookies.  The PHP $_REQUEST variable can be used to get the result from form data sent with both the GET and POST methods.  $_REQUEST[“name”];  $_REQUEST[“fname”];  $_REQUEST[“age”]; 10
  • 11.  Both GET and POST create an array (e.g. array( key => value, key2 => value2, key3 => value3, ...)).This array holds key/value pairs, where keys are the names of the form controls and values are the input data from the user.  Both GET and POST are treated as $_GET and $_POST.These are superglobals, which means that they are always accessible, regardless of scope - and you can access them from any function, class or file without having to do anything special.  $_GET is an array of variables passed to the current script via the URL parameters.  $_POST is an array of variables passed to the current script via the HTTP POST method. 11
  • 12.  Information sent from a form with the GET method is visible to everyone (all variable names and values are displayed in the URL). GET also has limits on the amount of information to send.The limitation is about 2000 characters. However, because the variables are displayed in the URL, it is possible to bookmark the page.This can be useful in some cases.  GET may be used for sending non-sensitive data.  Note: GET should NEVER be used for sending passwords or other sensitive information! 12
  • 13.  Information sent from a form with the POST method is invisible to others (all names/values are embedded within the body of the HTTP request) and has no limits on the amount of information to send.  Moreover POST supports advanced functionality such as support for multi-part binary input while uploading files to server.  However, because the variables are not displayed in the URL, it is not possible to bookmark the page. 13