SlideShare a Scribd company logo
PHP Tutorials By Vineet Kumar Saini

                        $_GET and $_POST in PHP

Introduction

Using the GET and POST methods, the browser client can send data to the web server. In
PHP the GET and POST methods are used to retrieve information from forms, such as user
input. Get and Post are methods used to send data to the server. These methods are used
for data handling in forms. Where each method varies a little in the way they work.

GET Method

In the GET method, we can also send data to the server. But when using the GET method
we can't send the login details with a password because it is less secure (information sent
from a form with the GET method is visible to everyone). We can say that the GET method
is for getting something from the server; it doesn't mean that you cannot send a parameter
to the server.

The main points about the GET method are as follows:

      The GET method is used to collect values in a form.
      GET method is used when the URL is sent to the server.
      GET method has limits on the amount of information to send because URL lengths
       are limited.
      The Get method is used to retrieve web pages from the server.
      The GET method is the default method for many browsers.
      Data is sent as a part of the URL in 'name-value' pairs.
      In the GET method page and the encoded information are separated by the question
       mark (?) sign.
      In the GET method, the browser appends the data onto the URL.
      The Get method is less secure because information sent from a form with the GET
       method is visible to everyone (it will be displayed in the browser's address bar) .
      GET can't be used to send binary data, like images or word documents, to the
       server.

Example

First of all we create a PHP file which is called by the HTML page in later.

<html>
<body bgcolor="pink">
Welcome <?php echo $_GET ["Name"]; ?>.<br/>
You are <?php echo $_GET ["Class"]; ?> Qualified !!
</body>
</html>

The above file is to be saved with the name "get.php", which is called by the HTML page
later.

<html>
<body bgcolor="pink"><table>
PHP Tutorials By Vineet Kumar Saini

<form action="get.php" method="get">
<tr><td>Name: <input type="text" name="Name" /></td></tr>
<tr><td>Class : <input type="text" name="Class" /></td></tr>
<input type="submit" " value="Submit"/>
</form>
</body>
</html>

This file is saved as "get.html". In this file get.php is called.

Output

You will put the URL in the web browser like as: http://localhost/FolderName/get.html.




Now you will fill text like as name and class. When you click on the submit button then you
will see your browser URL changed. You can see in the following image.
PHP Tutorials By Vineet Kumar Saini

POST Method

In PHP $_POST variable is used to collect values from a form sent with method="post". In
the POST method one can request as well as send some data to the server. The POST
method is used when one can send a long enquiry form. Using the POST method the login
details with password can be posted because it is secure (information sent from a form with
the POST method is invisible to everyone).

The main points about POST method are as follows:

      The POST method is used to collect values from a form.
      The POST method has no limits on the amount of information to send because URL
       lengths are unlimited.
      The POST method is the not default method for many browsers.
      In the POST method, the page and the encoded information are not separated by the
       question mark (?) sign.
      In the POST method, the browser doesn't append the data onto the URL.
      The POST method is secure because information sent from a form with the GET
       method is invisible to everyone.
      The POST method can be used to send binary data, like images or Word documents,
       to the server.
      In the POST method, the data is sent as standard input.
      The POST method is slower than the GET method.
      PHP provides the $_POST associative array to access all the information sent using
       the GET method.

Example

First of all we create a PHP file which is called by the HTML page later.

<html>
<body bgcolor="pink">
Welcome <?php echo $_POST ["Name"]; ?>.<br/>
You are <?php echo $_POST ["Class"]; ?> Qualified !!
</body>
</html>

The above file is saved with the "post.php" name, which is called by the HTML page later.

<html>
<body bgcolor="pink">
<table>
<form action="post.php" method="post">
<tr><td>Name: <input type="text" name="Name" /></td></tr>
<tr><td>Class : <input type="text" name="Class" /></td></tr>
<input type="submit" " value="Submit"/>
</form>
</body>
</html>

This file is saved as "post.html". In this file post.php is called.
PHP Tutorials By Vineet Kumar Saini




Now you will fill text like as name and class. When you click on the submit button then you
will see your browser URL is not changed. You can see in the following image.




$_REQUEST Variable

The $_REQUEST variable is also used to send data to the server. The $_REQUEST variable is
a predefined variable in PHP. Which keeps the $_GET, $_POST and also $_Cookie variable.
This variable is used to collect data of the form sent by the GET and POST methods.

First of all we create a PHP file which is called by the HTML page later.

<html>
<body bgcolor="pink">
Welcome <?php echo $_REQUEST ["Name"]; ?>.<br/>
You are <?php echo $_REQUEST ["Class"]; ?> Qualified !!
PHP Tutorials By Vineet Kumar Saini

</body>
</html>

The above file is saved with the "request.php" name, which is called by the HTML page
later.

<html>
<body bgcolor="pink">
<table>
<form action="request.php" method="post">
<tr><td>Name: <input type="text" name="Name" /></td></tr>
<tr><td>Class : <input type="text" name="Class" /></td></tr>
<input type="submit" " value="Submit"/>
</form>
</body>
</html>

This file is save as "request.html". In this file post.php is called.




If we use the POST method then the URL of the browser is not append. You can see in
the following image.
PHP Tutorials By Vineet Kumar Saini




If we use the GET method then the URL of the browser is changed. You can see in the
following image.




Conclusion

So in this article you saw the differences between the GET and POST methods in PHP.

More Related Content

What's hot

PHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requirePHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and require
TheCreativedev Blog
 
php
phpphp
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
Gil Fink
 
laravel.pptx
laravel.pptxlaravel.pptx
laravel.pptx
asif290119
 
Operators php
Operators phpOperators php
Operators php
Chandni Pm
 
Server Side Programming
Server Side ProgrammingServer Side Programming
Server Side Programming
Milan Thapa
 
Web technology practical list
Web technology practical listWeb technology practical list
Web technology practical list
desaipratu10
 
jQuery
jQueryjQuery
PHP - Introduction to PHP Forms
PHP - Introduction to PHP FormsPHP - Introduction to PHP Forms
PHP - Introduction to PHP Forms
Vibrant Technologies & Computers
 
Dom
DomDom
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
WebStackAcademy
 
Html forms
Html formsHtml forms
Operators in PHP
Operators in PHPOperators in PHP
Operators in PHP
Vineet Kumar Saini
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
Amit Tyagi
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
Singsys Pte Ltd
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
Partnered Health
 
PHP variables
PHP  variablesPHP  variables
PHP variables
Siddique Ibrahim
 
Html media
Html mediaHtml media
Html media
Webtech Learning
 
Javascript dom event
Javascript dom eventJavascript dom event
Javascript dom event
Bunlong Van
 

What's hot (20)

PHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and requirePHP - DataType,Variable,Constant,Operators,Array,Include and require
PHP - DataType,Variable,Constant,Operators,Array,Include and require
 
php
phpphp
php
 
Introduction to HTML5
Introduction to HTML5Introduction to HTML5
Introduction to HTML5
 
laravel.pptx
laravel.pptxlaravel.pptx
laravel.pptx
 
Operators php
Operators phpOperators php
Operators php
 
Server Side Programming
Server Side ProgrammingServer Side Programming
Server Side Programming
 
Web technology practical list
Web technology practical listWeb technology practical list
Web technology practical list
 
jQuery
jQueryjQuery
jQuery
 
PHP - Introduction to PHP Forms
PHP - Introduction to PHP FormsPHP - Introduction to PHP Forms
PHP - Introduction to PHP Forms
 
Dom
DomDom
Dom
 
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 13 - Browser Object Model(BOM)
 
Html forms
Html formsHtml forms
Html forms
 
Operators in PHP
Operators in PHPOperators in PHP
Operators in PHP
 
Introduction to CSS
Introduction to CSSIntroduction to CSS
Introduction to CSS
 
Php mysql ppt
Php mysql pptPhp mysql ppt
Php mysql ppt
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
 
Dom(document object model)
Dom(document object model)Dom(document object model)
Dom(document object model)
 
PHP variables
PHP  variablesPHP  variables
PHP variables
 
Html media
Html mediaHtml media
Html media
 
Javascript dom event
Javascript dom eventJavascript dom event
Javascript dom event
 

Viewers also liked

AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900
AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900
AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900
Devrhoid Davis
 
Getting Started with SainSmart SIM900 GPRS (Autosaved)
Getting Started with SainSmart SIM900 GPRS (Autosaved)Getting Started with SainSmart SIM900 GPRS (Autosaved)
Getting Started with SainSmart SIM900 GPRS (Autosaved)
Devrhoid Davis
 
GSM GPRS SIM900A Modem
GSM GPRS SIM900A ModemGSM GPRS SIM900A Modem
GSM GPRS SIM900A Modem
Raghav Shetty
 
SQL Limit in PHP
SQL Limit in PHPSQL Limit in PHP
SQL Limit in PHP
Vineet Kumar Saini
 
CSS in HTML
CSS in HTMLCSS in HTML
CSS in HTML
Vineet Kumar Saini
 
Browser information in PHP
Browser information in PHPBrowser information in PHP
Browser information in PHP
Vineet Kumar Saini
 
Programming in C
Programming in CProgramming in C
Programming in C
Vineet Kumar Saini
 
Pagination in PHP
Pagination in PHPPagination in PHP
Pagination in PHP
Vineet Kumar Saini
 
MVC in PHP
MVC in PHPMVC in PHP
MVC in PHP
Vineet Kumar Saini
 
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.
John Donohoe
 
About BLE server profile
About BLE server profile About BLE server profile
About BLE server profile
Lin Steven
 
Most usefull at commands
Most usefull at commandsMost usefull at commands
Most usefull at commands
Vishnu Chittan Mudrakartha
 
Ble overview and_implementation
Ble overview and_implementationBle overview and_implementation
Ble overview and_implementation
Stanley Chang
 
Sim900
Sim900Sim900
The Internet of Things: BLE / Beacons / iBeacons
The Internet of Things: BLE / Beacons / iBeaconsThe Internet of Things: BLE / Beacons / iBeacons
The Internet of Things: BLE / Beacons / iBeacons
Vectorform
 
Bluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technologyBluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technology
Lin Steven
 
Gsm based campus display system project report
Gsm based campus display system project reportGsm based campus display system project report
Gsm based campus display system project report
Kashyap Shah
 
Practice exam php
Practice exam phpPractice exam php
Practice exam php
Yesenia Sánchez Sosa
 
PHP Technical Questions
PHP Technical QuestionsPHP Technical Questions
PHP Technical Questions
Pankaj Jha
 
Top 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersTop 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and Answers
Vineet Kumar Saini
 

Viewers also liked (20)

AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900
AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900
AT COMMAND SET FOR SENDING DATA VIA TCP USING SIM900
 
Getting Started with SainSmart SIM900 GPRS (Autosaved)
Getting Started with SainSmart SIM900 GPRS (Autosaved)Getting Started with SainSmart SIM900 GPRS (Autosaved)
Getting Started with SainSmart SIM900 GPRS (Autosaved)
 
GSM GPRS SIM900A Modem
GSM GPRS SIM900A ModemGSM GPRS SIM900A Modem
GSM GPRS SIM900A Modem
 
SQL Limit in PHP
SQL Limit in PHPSQL Limit in PHP
SQL Limit in PHP
 
CSS in HTML
CSS in HTMLCSS in HTML
CSS in HTML
 
Browser information in PHP
Browser information in PHPBrowser information in PHP
Browser information in PHP
 
Programming in C
Programming in CProgramming in C
Programming in C
 
Pagination in PHP
Pagination in PHPPagination in PHP
Pagination in PHP
 
MVC in PHP
MVC in PHPMVC in PHP
MVC in PHP
 
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.
2014 App Dev Confr. - iBeacons, BLE Beacons and Everything in Between.
 
About BLE server profile
About BLE server profile About BLE server profile
About BLE server profile
 
Most usefull at commands
Most usefull at commandsMost usefull at commands
Most usefull at commands
 
Ble overview and_implementation
Ble overview and_implementationBle overview and_implementation
Ble overview and_implementation
 
Sim900
Sim900Sim900
Sim900
 
The Internet of Things: BLE / Beacons / iBeacons
The Internet of Things: BLE / Beacons / iBeaconsThe Internet of Things: BLE / Beacons / iBeacons
The Internet of Things: BLE / Beacons / iBeacons
 
Bluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technologyBluetooth low energy(ble) wireless technology
Bluetooth low energy(ble) wireless technology
 
Gsm based campus display system project report
Gsm based campus display system project reportGsm based campus display system project report
Gsm based campus display system project report
 
Practice exam php
Practice exam phpPractice exam php
Practice exam php
 
PHP Technical Questions
PHP Technical QuestionsPHP Technical Questions
PHP Technical Questions
 
Top 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and AnswersTop 100 PHP Interview Questions and Answers
Top 100 PHP Interview Questions and Answers
 

Similar to GET and POST in PHP

Making web forms using php
Making web forms using phpMaking web forms using php
Making web forms using php
krishnapriya Tadepalli
 
Introduction to php web programming - get and post
Introduction to php  web programming - get and postIntroduction to php  web programming - get and post
Introduction to php web programming - get and post
baabtra.com - No. 1 supplier of quality freshers
 
PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
Ahmed Saihood
 
Get and post methods in php - phpgurukul
Get and post methods in php  - phpgurukulGet and post methods in php  - phpgurukul
Get and post methods in php - phpgurukul
PHPGurukul Blog
 
Get method and post method
Get method and post methodGet method and post method
Lecture7 form processing by okello erick
Lecture7 form processing by okello erickLecture7 form processing by okello erick
Lecture7 form processing by okello erick
okelloerick
 
Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2
Gheyath M. Othman
 
PHP Making Web Forms
PHP Making Web FormsPHP Making Web Forms
PHP Making Web Forms
krishnapriya Tadepalli
 
Form Handling using PHP
Form Handling using PHPForm Handling using PHP
Form Handling using PHP
Nisa Soomro
 
Php forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligetiPhp forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligeti
Naveen Kumar Veligeti
 
Web app development_php_07
Web app development_php_07Web app development_php_07
Web app development_php_07
Hassen Poreya
 
Form handling in php
Form handling in phpForm handling in php
Form handling in php
Fahad Khan
 
Class 6 - PHP Web Programming
Class 6 - PHP Web ProgrammingClass 6 - PHP Web Programming
Class 6 - PHP Web Programming
Ahmed Swilam
 
forms.pptx
forms.pptxforms.pptx
forms.pptx
asmabagersh
 
Sessions n cookies
Sessions n cookiesSessions n cookies
Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5
Mohd Harris Ahmad Jaal
 
Working with data.pptx
Working with data.pptxWorking with data.pptx
Working with data.pptx
SherinRappai
 
Introduction to web development - HTML 5
Introduction to web development - HTML 5Introduction to web development - HTML 5
Introduction to web development - HTML 5
Ayoub Ghozzi
 
Session and cookies ,get and post methods
Session and cookies ,get and post methodsSession and cookies ,get and post methods
Session and cookies ,get and post methods
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxChapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptx
ShitalGhotekar
 

Similar to GET and POST in PHP (20)

Making web forms using php
Making web forms using phpMaking web forms using php
Making web forms using php
 
Introduction to php web programming - get and post
Introduction to php  web programming - get and postIntroduction to php  web programming - get and post
Introduction to php web programming - get and post
 
PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
 
Get and post methods in php - phpgurukul
Get and post methods in php  - phpgurukulGet and post methods in php  - phpgurukul
Get and post methods in php - phpgurukul
 
Get method and post method
Get method and post methodGet method and post method
Get method and post method
 
Lecture7 form processing by okello erick
Lecture7 form processing by okello erickLecture7 form processing by okello erick
Lecture7 form processing by okello erick
 
Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2
 
PHP Making Web Forms
PHP Making Web FormsPHP Making Web Forms
PHP Making Web Forms
 
Form Handling using PHP
Form Handling using PHPForm Handling using PHP
Form Handling using PHP
 
Php forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligetiPhp forms and validations by naveen kumar veligeti
Php forms and validations by naveen kumar veligeti
 
Web app development_php_07
Web app development_php_07Web app development_php_07
Web app development_php_07
 
Form handling in php
Form handling in phpForm handling in php
Form handling in php
 
Class 6 - PHP Web Programming
Class 6 - PHP Web ProgrammingClass 6 - PHP Web Programming
Class 6 - PHP Web Programming
 
forms.pptx
forms.pptxforms.pptx
forms.pptx
 
Sessions n cookies
Sessions n cookiesSessions n cookies
Sessions n cookies
 
Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5Web Application Development using PHP Chapter 5
Web Application Development using PHP Chapter 5
 
Working with data.pptx
Working with data.pptxWorking with data.pptx
Working with data.pptx
 
Introduction to web development - HTML 5
Introduction to web development - HTML 5Introduction to web development - HTML 5
Introduction to web development - HTML 5
 
Session and cookies ,get and post methods
Session and cookies ,get and post methodsSession and cookies ,get and post methods
Session and cookies ,get and post methods
 
Chapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxChapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptx
 

More from Vineet Kumar Saini

Abstract Class and Interface in PHP
Abstract Class and Interface in PHPAbstract Class and Interface in PHP
Abstract Class and Interface in PHP
Vineet Kumar Saini
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPAdd edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHP
Vineet Kumar Saini
 
Introduction to Html
Introduction to HtmlIntroduction to Html
Introduction to Html
Vineet Kumar Saini
 
Computer Fundamentals
Computer FundamentalsComputer Fundamentals
Computer Fundamentals
Vineet Kumar Saini
 
Country State City Dropdown in PHP
Country State City Dropdown in PHPCountry State City Dropdown in PHP
Country State City Dropdown in PHP
Vineet Kumar Saini
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
Vineet Kumar Saini
 
Install Drupal on Wamp Server
Install Drupal on Wamp ServerInstall Drupal on Wamp Server
Install Drupal on Wamp Server
Vineet Kumar Saini
 
Joomla 2.5 Tutorial For Beginner PDF
Joomla 2.5 Tutorial For Beginner PDFJoomla 2.5 Tutorial For Beginner PDF
Joomla 2.5 Tutorial For Beginner PDF
Vineet Kumar Saini
 
Functions in PHP
Functions in PHPFunctions in PHP
Functions in PHP
Vineet Kumar Saini
 
Sorting arrays in PHP
Sorting arrays in PHPSorting arrays in PHP
Sorting arrays in PHP
Vineet Kumar Saini
 
Dropdown List in PHP
Dropdown List in PHPDropdown List in PHP
Dropdown List in PHP
Vineet Kumar Saini
 
Update statement in PHP
Update statement in PHPUpdate statement in PHP
Update statement in PHP
Vineet Kumar Saini
 
Delete statement in PHP
Delete statement in PHPDelete statement in PHP
Delete statement in PHP
Vineet Kumar Saini
 
Implode & Explode in PHP
Implode & Explode in PHPImplode & Explode in PHP
Implode & Explode in PHP
Vineet Kumar Saini
 
Types of Error in PHP
Types of Error in PHPTypes of Error in PHP
Types of Error in PHP
Vineet Kumar Saini
 
Database connectivity in PHP
Database connectivity in PHPDatabase connectivity in PHP
Database connectivity in PHP
Vineet Kumar Saini
 
Arrays in PHP
Arrays in PHPArrays in PHP
Arrays in PHP
Vineet Kumar Saini
 
Variables in PHP
Variables in PHPVariables in PHP
Variables in PHP
Vineet Kumar Saini
 
Print function in PHP
Print function in PHPPrint function in PHP
Print function in PHP
Vineet Kumar Saini
 

More from Vineet Kumar Saini (20)

Abstract Class and Interface in PHP
Abstract Class and Interface in PHPAbstract Class and Interface in PHP
Abstract Class and Interface in PHP
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPAdd edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHP
 
Introduction to Html
Introduction to HtmlIntroduction to Html
Introduction to Html
 
Computer Fundamentals
Computer FundamentalsComputer Fundamentals
Computer Fundamentals
 
Country State City Dropdown in PHP
Country State City Dropdown in PHPCountry State City Dropdown in PHP
Country State City Dropdown in PHP
 
Stripe in php
Stripe in phpStripe in php
Stripe in php
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
 
Install Drupal on Wamp Server
Install Drupal on Wamp ServerInstall Drupal on Wamp Server
Install Drupal on Wamp Server
 
Joomla 2.5 Tutorial For Beginner PDF
Joomla 2.5 Tutorial For Beginner PDFJoomla 2.5 Tutorial For Beginner PDF
Joomla 2.5 Tutorial For Beginner PDF
 
Functions in PHP
Functions in PHPFunctions in PHP
Functions in PHP
 
Sorting arrays in PHP
Sorting arrays in PHPSorting arrays in PHP
Sorting arrays in PHP
 
Dropdown List in PHP
Dropdown List in PHPDropdown List in PHP
Dropdown List in PHP
 
Update statement in PHP
Update statement in PHPUpdate statement in PHP
Update statement in PHP
 
Delete statement in PHP
Delete statement in PHPDelete statement in PHP
Delete statement in PHP
 
Implode & Explode in PHP
Implode & Explode in PHPImplode & Explode in PHP
Implode & Explode in PHP
 
Types of Error in PHP
Types of Error in PHPTypes of Error in PHP
Types of Error in PHP
 
Database connectivity in PHP
Database connectivity in PHPDatabase connectivity in PHP
Database connectivity in PHP
 
Arrays in PHP
Arrays in PHPArrays in PHP
Arrays in PHP
 
Variables in PHP
Variables in PHPVariables in PHP
Variables in PHP
 
Print function in PHP
Print function in PHPPrint function in PHP
Print function in PHP
 

Recently uploaded

Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
National Information Standards Organization (NISO)
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
EduSkills OECD
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptxBeyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
Beyond Degrees - Empowering the Workforce in the Context of Skills-First.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 

GET and POST in PHP

  • 1. PHP Tutorials By Vineet Kumar Saini $_GET and $_POST in PHP Introduction Using the GET and POST methods, the browser client can send data to the web server. In PHP the GET and POST methods are used to retrieve information from forms, such as user input. Get and Post are methods used to send data to the server. These methods are used for data handling in forms. Where each method varies a little in the way they work. GET Method In the GET method, we can also send data to the server. But when using the GET method we can't send the login details with a password because it is less secure (information sent from a form with the GET method is visible to everyone). We can say that the GET method is for getting something from the server; it doesn't mean that you cannot send a parameter to the server. The main points about the GET method are as follows:  The GET method is used to collect values in a form.  GET method is used when the URL is sent to the server.  GET method has limits on the amount of information to send because URL lengths are limited.  The Get method is used to retrieve web pages from the server.  The GET method is the default method for many browsers.  Data is sent as a part of the URL in 'name-value' pairs.  In the GET method page and the encoded information are separated by the question mark (?) sign.  In the GET method, the browser appends the data onto the URL.  The Get method is less secure because information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) .  GET can't be used to send binary data, like images or word documents, to the server. Example First of all we create a PHP file which is called by the HTML page in later. <html> <body bgcolor="pink"> Welcome <?php echo $_GET ["Name"]; ?>.<br/> You are <?php echo $_GET ["Class"]; ?> Qualified !! </body> </html> The above file is to be saved with the name "get.php", which is called by the HTML page later. <html> <body bgcolor="pink"><table>
  • 2. PHP Tutorials By Vineet Kumar Saini <form action="get.php" method="get"> <tr><td>Name: <input type="text" name="Name" /></td></tr> <tr><td>Class : <input type="text" name="Class" /></td></tr> <input type="submit" " value="Submit"/> </form> </body> </html> This file is saved as "get.html". In this file get.php is called. Output You will put the URL in the web browser like as: http://localhost/FolderName/get.html. Now you will fill text like as name and class. When you click on the submit button then you will see your browser URL changed. You can see in the following image.
  • 3. PHP Tutorials By Vineet Kumar Saini POST Method In PHP $_POST variable is used to collect values from a form sent with method="post". In the POST method one can request as well as send some data to the server. The POST method is used when one can send a long enquiry form. Using the POST method the login details with password can be posted because it is secure (information sent from a form with the POST method is invisible to everyone). The main points about POST method are as follows:  The POST method is used to collect values from a form.  The POST method has no limits on the amount of information to send because URL lengths are unlimited.  The POST method is the not default method for many browsers.  In the POST method, the page and the encoded information are not separated by the question mark (?) sign.  In the POST method, the browser doesn't append the data onto the URL.  The POST method is secure because information sent from a form with the GET method is invisible to everyone.  The POST method can be used to send binary data, like images or Word documents, to the server.  In the POST method, the data is sent as standard input.  The POST method is slower than the GET method.  PHP provides the $_POST associative array to access all the information sent using the GET method. Example First of all we create a PHP file which is called by the HTML page later. <html> <body bgcolor="pink"> Welcome <?php echo $_POST ["Name"]; ?>.<br/> You are <?php echo $_POST ["Class"]; ?> Qualified !! </body> </html> The above file is saved with the "post.php" name, which is called by the HTML page later. <html> <body bgcolor="pink"> <table> <form action="post.php" method="post"> <tr><td>Name: <input type="text" name="Name" /></td></tr> <tr><td>Class : <input type="text" name="Class" /></td></tr> <input type="submit" " value="Submit"/> </form> </body> </html> This file is saved as "post.html". In this file post.php is called.
  • 4. PHP Tutorials By Vineet Kumar Saini Now you will fill text like as name and class. When you click on the submit button then you will see your browser URL is not changed. You can see in the following image. $_REQUEST Variable The $_REQUEST variable is also used to send data to the server. The $_REQUEST variable is a predefined variable in PHP. Which keeps the $_GET, $_POST and also $_Cookie variable. This variable is used to collect data of the form sent by the GET and POST methods. First of all we create a PHP file which is called by the HTML page later. <html> <body bgcolor="pink"> Welcome <?php echo $_REQUEST ["Name"]; ?>.<br/> You are <?php echo $_REQUEST ["Class"]; ?> Qualified !!
  • 5. PHP Tutorials By Vineet Kumar Saini </body> </html> The above file is saved with the "request.php" name, which is called by the HTML page later. <html> <body bgcolor="pink"> <table> <form action="request.php" method="post"> <tr><td>Name: <input type="text" name="Name" /></td></tr> <tr><td>Class : <input type="text" name="Class" /></td></tr> <input type="submit" " value="Submit"/> </form> </body> </html> This file is save as "request.html". In this file post.php is called. If we use the POST method then the URL of the browser is not append. You can see in the following image.
  • 6. PHP Tutorials By Vineet Kumar Saini If we use the GET method then the URL of the browser is changed. You can see in the following image. Conclusion So in this article you saw the differences between the GET and POST methods in PHP.