SlideShare a Scribd company logo
6
Most read
12
Most read
13
Most read
Course Instructor: Nisa Soomro 
Prog_nisa@quest.edu.pk 
nisa1207@gmail.com
 $_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
 www.w3school.com 
 http://www.tutorialspoint.com/php/index.htm 
 http://www.w3schools.com/php/php_ref_string.asp 
14

More Related Content

PPT
Oops concepts in php
PPTX
Methods of data collection
PPT
Php forms
PPSX
Php and MySQL
PPT
Php with MYSQL Database
PPT
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
PPTX
Ajax ppt - 32 slides
PPT
PHP - Introduction to PHP AJAX
Oops concepts in php
Methods of data collection
Php forms
Php and MySQL
Php with MYSQL Database
CHAPTER 6 REQUIREMENTS MODELING: SCENARIO based Model , Class based moddel
Ajax ppt - 32 slides
PHP - Introduction to PHP AJAX

What's hot (20)

PDF
Chap 4 PHP.pdf
PPTX
HTML Forms
PPTX
PHP FUNCTIONS
PPT
Span and Div tags in HTML
PPTX
Php string function
PPTX
Introduction to php
PPTX
Javascript
PPT
PHP - DataType,Variable,Constant,Operators,Array,Include and require
PPTX
Lab #2: Introduction to Javascript
PDF
Introduction to HTML5
ODP
Introduction of Html/css/js
PDF
JavaScript - Chapter 11 - Events
PPTX
Event In JavaScript
PPT
javaScript.ppt
PPT
Css Ppt
PPSX
Javascript variables and datatypes
PPT
PDF
Web Development Course: PHP lecture 1
Chap 4 PHP.pdf
HTML Forms
PHP FUNCTIONS
Span and Div tags in HTML
Php string function
Introduction to php
Javascript
PHP - DataType,Variable,Constant,Operators,Array,Include and require
Lab #2: Introduction to Javascript
Introduction to HTML5
Introduction of Html/css/js
JavaScript - Chapter 11 - Events
Event In JavaScript
javaScript.ppt
Css Ppt
Javascript variables and datatypes
Web Development Course: PHP lecture 1
Ad

Viewers also liked (12)

PPTX
PPTX
Android session 2-behestee
PDF
Dalvik Source Code Reading
PPTX
Android Life Cycle
PDF
Android life cycle
PPTX
PHP Cookies and Sessions
PDF
Android intents
PDF
Android Studio NDK(JNI) + OpenCV 完整教學
PDF
Android: Intent, Intent Filter, Broadcast Receivers
PDF
Android Lesson 3 - Intent
PPTX
Android - Broadcast Receiver
PDF
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Android session 2-behestee
Dalvik Source Code Reading
Android Life Cycle
Android life cycle
PHP Cookies and Sessions
Android intents
Android Studio NDK(JNI) + OpenCV 完整教學
Android: Intent, Intent Filter, Broadcast Receivers
Android Lesson 3 - Intent
Android - Broadcast Receiver
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Ad

Similar to Form Handling using PHP (20)

PDF
Form handling in php
PPT
Lecture7 form processing by okello erick
PDF
Making web forms using php
PDF
GET and POST in PHP
PPTX
Unit - III.pptxbgffhjxfjdfjfgjnsnsnshdhsjsksjsjsjsjsjsjsjsjsldksk
PPTX
Unit - III.pptxbgffhjxfjdfjfgjnsnsnshdhsjsksjsjsjsjsjsjsjsjsldksk
PPTX
WorkingwithFormsinPHPpptx__2024_10_17_19_07_07 2.pptx
PPTX
forms.pptx
PDF
PHP-Part4
PPTX
5. Formshcfsjhfajkjsfjsjfjksafjsfjkjfhjsafjsajkgfjskafkjas.pptx
PDF
Web app development_php_07
PPTX
Get and post methods in php - phpgurukul
PPTX
A179178417_21_2025_PHP Get and Post.pptx
PPTX
Web Techniques like Cookies and Sessions
PDF
PHP Making Web Forms
PPTX
Working with data.pptx
PPT
Chapter 07 php forms handling
DOCX
Php forms and validations by naveen kumar veligeti
PDF
Http and security
PDF
Introduction to php web programming - get and post
Form handling in php
Lecture7 form processing by okello erick
Making web forms using php
GET and POST in PHP
Unit - III.pptxbgffhjxfjdfjfgjnsnsnshdhsjsksjsjsjsjsjsjsjsjsldksk
Unit - III.pptxbgffhjxfjdfjfgjnsnsnshdhsjsksjsjsjsjsjsjsjsjsldksk
WorkingwithFormsinPHPpptx__2024_10_17_19_07_07 2.pptx
forms.pptx
PHP-Part4
5. Formshcfsjhfajkjsfjsjfjksafjsfjkjfhjsafjsajkgfjskafkjas.pptx
Web app development_php_07
Get and post methods in php - phpgurukul
A179178417_21_2025_PHP Get and Post.pptx
Web Techniques like Cookies and Sessions
PHP Making Web Forms
Working with data.pptx
Chapter 07 php forms handling
Php forms and validations by naveen kumar veligeti
Http and security
Introduction to php web programming - get and post

More from Nisa Soomro (16)

PPTX
Connecting to my sql using PHP
PPTX
Basic of PHP
PPTX
PHP Filing
PPTX
PPTX
HTML Basic Tags
PPTX
HTML Forms
PPTX
HTML Frameset & Inline Frame
PPTX
HTML Images
PPTX
HTML Lists & Llinks
PPTX
HTML Tables
PPTX
Html5 SVG
PPTX
Html5 Canvas Detail
PPTX
Html5 canvas
PPTX
PPTX
PPTX
Web programming lec#3
Connecting to my sql using PHP
Basic of PHP
PHP Filing
HTML Basic Tags
HTML Forms
HTML Frameset & Inline Frame
HTML Images
HTML Lists & Llinks
HTML Tables
Html5 SVG
Html5 Canvas Detail
Html5 canvas
Web programming lec#3

Recently uploaded (20)

PDF
English Language Teaching from Post-.pdf
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Congenital Hypothyroidism pptx
PPTX
Strengthening open access through collaboration: building connections with OP...
PPTX
How to Manage Loyalty Points in Odoo 18 Sales
PDF
LDMMIA Reiki Yoga S2 L3 Vod Sample Preview
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
Software Engineering BSC DS UNIT 1 .pptx
PDF
UTS Health Student Promotional Representative_Position Description.pdf
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
PPTX
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
PDF
Sunset Boulevard Student Revision Booklet
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PPTX
How to Manage Global Discount in Odoo 18 POS
PDF
LDMMIA Reiki Yoga Workshop 15 MidTerm Review
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
English Language Teaching from Post-.pdf
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Congenital Hypothyroidism pptx
Strengthening open access through collaboration: building connections with OP...
How to Manage Loyalty Points in Odoo 18 Sales
LDMMIA Reiki Yoga S2 L3 Vod Sample Preview
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Software Engineering BSC DS UNIT 1 .pptx
UTS Health Student Promotional Representative_Position Description.pdf
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
Sunset Boulevard Student Revision Booklet
Open Quiz Monsoon Mind Game Prelims.pptx
UPPER GASTRO INTESTINAL DISORDER.docx
How to Manage Starshipit in Odoo 18 - Odoo Slides
Open Quiz Monsoon Mind Game Final Set.pptx
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
How to Manage Global Discount in Odoo 18 POS
LDMMIA Reiki Yoga Workshop 15 MidTerm Review
102 student loan defaulters named and shamed – Is someone you know on the list?

Form Handling using PHP

  • 2.  $_GET  $_POST  $_REQUEST 2
  • 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
  • 14.  www.w3school.com  http://www.tutorialspoint.com/php/index.htm  http://www.w3schools.com/php/php_ref_string.asp 14