SlideShare a Scribd company logo
GET and POST Methods
The client browser uses two methods to send
information from the client to the web server. These
methods are GET and POST. However, before
sending the information, the browser first encodes
the information using the coding scheme called URL
encoding.
In this coding scheme, key-value pairs, which are
here name-value pairs, which are here name-value
pairs, are combined together in such a way that
different name-value pairs are separated by &
(ampersand). Any whitespaces are replaced by the
plus sign(+) and non-alphanumeric characters are
replaced with their hexadecimal values. Once the
encoding process is over, the data is sent to the web
server. https://phpgurukul.com/get-and-post-
methods/
The GET Method
 When the GET method is used for sending
information to the web server, it sends the same
along with the page URL. The URL is appended
by the encoded information and the question
mark sign (?) separates the former from the
latter. Some of the key things to note about the
use of this method include –
 Since this method appends the page URL, the
sent information will also appear in the logs of
the server.
 The maximum number of characters that can be
sent using the GET method is 1024 characters.
 There is an inherent issue of compromised
confidentiality with this method. Therefore, its use
must be avoided when you are sending
passwords or critical information to the
webserver.
https://phpgurukul.com/get-and-post-
methods/
 Another inherent limitation of the GET
method is that documents and images
cannot be sent to the server using this
method.
 Besides the above-mentioned, it is also
possible to access the data sent using
this method by retrieving the
QUERY_STRING environment
variable. Therefore, data is not safe.
 It is possible to access all the sent
information using this method by
accessing $_GET, which is an
associative array provided by PHP for
this purpose. https://phpgurukul.com/get-and-post-
methods/
<?php
if($_GET[“name”] || $_GET[“age”]){
echo “Welcome”. $_GET[‘name’].”<br />”;
echo “You are”. $_GET[age].”years old”;
exit();
}
<html>
<body>
<form action=”<?php $_PHP_SELF?>”
method=”GET”>
Name: <input type=”text” name=”name” />
Age: <input type=”text” name=”age” />
<input type=”submit”>
</form>
</body>
</html> https://phpgurukul.com/get-and-post-
methods/
The POST Method
 An alternative to the GET method is the POST method. This
method makes uses of HTTP headers to transfer information
from the client to the server. The encoded information is out
into the header. Some of the things that you must know about
the use of this method for information transfer has been listed
below-
 Unlike the GET method, there is no limitation on the number
of characters that can be sent using this method.
 It is possible to send binary as well as ASCII data using this
method.
 As far as the security of data is concerned, data security
totally lies in the hands of the HTTP protocol. You can ensure
higher security of data by using HTTP secure.
 All the data using the POST method can be accessed using
the $_POST associative array.
 You can try the sample code given below to understand how
this method is used.
https://phpgurukul.com/get-and-post-
methods/
<?php
if($_POST[“name”] || $_POST[“age”]){
if(preg_match(“/[^A-Za-z’-]/”,$_POST[‘name’])){
die(“Name is invalid”);
}
echo “Welcome”. $_POST[‘name’].”<br />”;
echo “You are”. $_POST[age].”years old”;
exit();
}
?>
<html>
<body>
<form action=”<?php $_PHP_SELF?>” method=”GET”>
Name: <input type=”text” name=”name” />
Age: <input type=”text” name=”age” />
<input type=”submit”>
</form>
</body>
</hml>
https://phpgurukul.com/get-and-post-
methods/
The $_REQUEST Variable
 The contents of $_GET and $_POST
are available in $_REQUEST. Besides
this, $_REQUEST also contains data
associated with $_COOKIE> The form
data sent to the webserver using both
the methods namely GET and POST
can be accessed by accessing this
variable.
 Here $_PHP_SELF variable contains
the name of the self script in which it is
being called.
https://phpgurukul.com/get-and-post-
methods/
For More Info
Visit: https://phpgurukul.com/get-and-
post-methods/
https://phpgurukul.com/get-and-post-
methods/

More Related Content

What's hot

21servers And Applets
21servers And Applets21servers And Applets
21servers And Applets
Adil Jafri
 
KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7
phuphax
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
Sahil Agarwal
 
Forms and Databases in PHP
Forms and Databases in PHPForms and Databases in PHP
Forms and Databases in PHP
Mike Crabb
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
Christopher Bartling
 
HTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status CodeHTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status Code
Abhishek L.R
 
How the web works june 2010
How the web works june 2010How the web works june 2010
How the web works june 2010
Mark Carter
 
Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014
Navaneethan Naveen
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
Nuha Noor
 
SCWCD : The web client model
SCWCD : The web client modelSCWCD : The web client model
SCWCD : The web client model
Ben Abdallah Helmi
 
Http headers
Http headersHttp headers
Http headers
Judy Ngure
 
HTTP fundamentals for developers
HTTP fundamentals for developersHTTP fundamentals for developers
HTTP fundamentals for developers
Mario Cardinal
 
Webbasics
WebbasicsWebbasics
Webbasics
patinijava
 
Php forms
Php formsPhp forms
Php forms
Anne Lee
 
Session12 J2ME Generic Connection Framework
Session12 J2ME Generic Connection FrameworkSession12 J2ME Generic Connection Framework
Session12 J2ME Generic Connection Framework
muthusvm
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
hussulinux
 
Web (HTTP) request to response life cycle
Web (HTTP) request to response life cycleWeb (HTTP) request to response life cycle
Web (HTTP) request to response life cycle
Gopakumar Kunduveetil
 
Html intake 38 lect1
Html intake 38 lect1Html intake 38 lect1
Html intake 38 lect1
ghkadous
 
Web application technologies
Web application technologiesWeb application technologies
Web application technologies
Atul Tiwari
 
HTTP Definition and Basics.
HTTP Definition and Basics.HTTP Definition and Basics.
HTTP Definition and Basics.
Halah Salih
 

What's hot (20)

21servers And Applets
21servers And Applets21servers And Applets
21servers And Applets
 
KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7KMUTNB - Internet Programming 2/7
KMUTNB - Internet Programming 2/7
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
Forms and Databases in PHP
Forms and Databases in PHPForms and Databases in PHP
Forms and Databases in PHP
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
HTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status CodeHTTP Request Header and HTTP Status Code
HTTP Request Header and HTTP Status Code
 
How the web works june 2010
How the web works june 2010How the web works june 2010
How the web works june 2010
 
Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014Http request&response by Vignesh 15 MAR 2014
Http request&response by Vignesh 15 MAR 2014
 
Http request and http response
Http request and http responseHttp request and http response
Http request and http response
 
SCWCD : The web client model
SCWCD : The web client modelSCWCD : The web client model
SCWCD : The web client model
 
Http headers
Http headersHttp headers
Http headers
 
HTTP fundamentals for developers
HTTP fundamentals for developersHTTP fundamentals for developers
HTTP fundamentals for developers
 
Webbasics
WebbasicsWebbasics
Webbasics
 
Php forms
Php formsPhp forms
Php forms
 
Session12 J2ME Generic Connection Framework
Session12 J2ME Generic Connection FrameworkSession12 J2ME Generic Connection Framework
Session12 J2ME Generic Connection Framework
 
PHP Training: Module 1
PHP Training: Module 1PHP Training: Module 1
PHP Training: Module 1
 
Web (HTTP) request to response life cycle
Web (HTTP) request to response life cycleWeb (HTTP) request to response life cycle
Web (HTTP) request to response life cycle
 
Html intake 38 lect1
Html intake 38 lect1Html intake 38 lect1
Html intake 38 lect1
 
Web application technologies
Web application technologiesWeb application technologies
Web application technologies
 
HTTP Definition and Basics.
HTTP Definition and Basics.HTTP Definition and Basics.
HTTP Definition and Basics.
 

Similar to Get and post methods in php - phpgurukul

PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
Ahmed Saihood
 
Working with data.pptx
Working with data.pptxWorking with data.pptx
Working with data.pptx
SherinRappai
 
forms.pptx
forms.pptxforms.pptx
forms.pptx
asmabagersh
 
PHP Making Web Forms
PHP Making Web FormsPHP Making Web Forms
PHP Making Web Forms
krishnapriya Tadepalli
 
Lecture7 form processing by okello erick
Lecture7 form processing by okello erickLecture7 form processing by okello erick
Lecture7 form processing by okello erick
okelloerick
 
Form handling in php
Form handling in phpForm handling in php
Form handling in php
Fahad Khan
 
Working with Data and built-in functions of PHP
Working with Data and built-in functions of PHPWorking with Data and built-in functions of PHP
Working with Data and built-in functions of PHP
mohanaps
 
Common Gateway Interface
Common Gateway InterfaceCommon Gateway Interface
Common Gateway Interface
Balu Masulkar
 
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 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
 
web2_lec6.pdf
web2_lec6.pdfweb2_lec6.pdf
web2_lec6.pdf
ssuser893014
 
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
 
Introduction to Web Programming with Perl
Introduction to Web Programming with PerlIntroduction to Web Programming with Perl
Introduction to Web Programming with Perl
Dave Cross
 
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
 
Chapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxChapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptx
ShitalGhotekar
 
HTTP Basics Demo
HTTP Basics DemoHTTP Basics Demo
HTTP Basics Demo
InMobi Technology
 
The constrained application protocol (co ap) part 2
The constrained application protocol (co ap)  part 2The constrained application protocol (co ap)  part 2
The constrained application protocol (co ap) part 2
Hamdamboy (함담보이)
 
The constrained application protocol (coap) part 2
The constrained application protocol (coap)  part 2The constrained application protocol (coap)  part 2
The constrained application protocol (coap) part 2
Hamdamboy
 
The constrained application protocol (coap) part 2
The constrained application protocol (coap)  part 2The constrained application protocol (coap)  part 2
The constrained application protocol (coap) part 2
Hamdamboy (함담보이)
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
Matthew Turland
 

Similar to Get and post methods in php - phpgurukul (20)

PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
 
Working with data.pptx
Working with data.pptxWorking with data.pptx
Working with data.pptx
 
forms.pptx
forms.pptxforms.pptx
forms.pptx
 
PHP Making Web Forms
PHP Making Web FormsPHP Making Web Forms
PHP Making Web Forms
 
Lecture7 form processing by okello erick
Lecture7 form processing by okello erickLecture7 form processing by okello erick
Lecture7 form processing by okello erick
 
Form handling in php
Form handling in phpForm handling in php
Form handling in php
 
Working with Data and built-in functions of PHP
Working with Data and built-in functions of PHPWorking with Data and built-in functions of PHP
Working with Data and built-in functions of PHP
 
Common Gateway Interface
Common Gateway InterfaceCommon Gateway Interface
Common Gateway Interface
 
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 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
 
web2_lec6.pdf
web2_lec6.pdfweb2_lec6.pdf
web2_lec6.pdf
 
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
 
Introduction to Web Programming with Perl
Introduction to Web Programming with PerlIntroduction to Web Programming with Perl
Introduction to Web Programming with Perl
 
Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2Web Development Course: PHP lecture 2
Web Development Course: PHP lecture 2
 
Chapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptxChapter 1.Web Techniques_Notes.pptx
Chapter 1.Web Techniques_Notes.pptx
 
HTTP Basics Demo
HTTP Basics DemoHTTP Basics Demo
HTTP Basics Demo
 
The constrained application protocol (co ap) part 2
The constrained application protocol (co ap)  part 2The constrained application protocol (co ap)  part 2
The constrained application protocol (co ap) part 2
 
The constrained application protocol (coap) part 2
The constrained application protocol (coap)  part 2The constrained application protocol (coap)  part 2
The constrained application protocol (coap) part 2
 
The constrained application protocol (coap) part 2
The constrained application protocol (coap)  part 2The constrained application protocol (coap)  part 2
The constrained application protocol (coap) part 2
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 

Recently uploaded

The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
Bisnar Chase Personal Injury Attorneys
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 

Recently uploaded (20)

The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Top five deadliest dog breeds in America
Top five deadliest dog breeds in AmericaTop five deadliest dog breeds in America
Top five deadliest dog breeds in America
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 

Get and post methods in php - phpgurukul

  • 1. GET and POST Methods The client browser uses two methods to send information from the client to the web server. These methods are GET and POST. However, before sending the information, the browser first encodes the information using the coding scheme called URL encoding. In this coding scheme, key-value pairs, which are here name-value pairs, which are here name-value pairs, are combined together in such a way that different name-value pairs are separated by & (ampersand). Any whitespaces are replaced by the plus sign(+) and non-alphanumeric characters are replaced with their hexadecimal values. Once the encoding process is over, the data is sent to the web server. https://phpgurukul.com/get-and-post- methods/
  • 2. The GET Method  When the GET method is used for sending information to the web server, it sends the same along with the page URL. The URL is appended by the encoded information and the question mark sign (?) separates the former from the latter. Some of the key things to note about the use of this method include –  Since this method appends the page URL, the sent information will also appear in the logs of the server.  The maximum number of characters that can be sent using the GET method is 1024 characters.  There is an inherent issue of compromised confidentiality with this method. Therefore, its use must be avoided when you are sending passwords or critical information to the webserver. https://phpgurukul.com/get-and-post- methods/
  • 3.  Another inherent limitation of the GET method is that documents and images cannot be sent to the server using this method.  Besides the above-mentioned, it is also possible to access the data sent using this method by retrieving the QUERY_STRING environment variable. Therefore, data is not safe.  It is possible to access all the sent information using this method by accessing $_GET, which is an associative array provided by PHP for this purpose. https://phpgurukul.com/get-and-post- methods/
  • 4. <?php if($_GET[“name”] || $_GET[“age”]){ echo “Welcome”. $_GET[‘name’].”<br />”; echo “You are”. $_GET[age].”years old”; exit(); } <html> <body> <form action=”<?php $_PHP_SELF?>” method=”GET”> Name: <input type=”text” name=”name” /> Age: <input type=”text” name=”age” /> <input type=”submit”> </form> </body> </html> https://phpgurukul.com/get-and-post- methods/
  • 5. The POST Method  An alternative to the GET method is the POST method. This method makes uses of HTTP headers to transfer information from the client to the server. The encoded information is out into the header. Some of the things that you must know about the use of this method for information transfer has been listed below-  Unlike the GET method, there is no limitation on the number of characters that can be sent using this method.  It is possible to send binary as well as ASCII data using this method.  As far as the security of data is concerned, data security totally lies in the hands of the HTTP protocol. You can ensure higher security of data by using HTTP secure.  All the data using the POST method can be accessed using the $_POST associative array.  You can try the sample code given below to understand how this method is used. https://phpgurukul.com/get-and-post- methods/
  • 6. <?php if($_POST[“name”] || $_POST[“age”]){ if(preg_match(“/[^A-Za-z’-]/”,$_POST[‘name’])){ die(“Name is invalid”); } echo “Welcome”. $_POST[‘name’].”<br />”; echo “You are”. $_POST[age].”years old”; exit(); } ?> <html> <body> <form action=”<?php $_PHP_SELF?>” method=”GET”> Name: <input type=”text” name=”name” /> Age: <input type=”text” name=”age” /> <input type=”submit”> </form> </body> </hml> https://phpgurukul.com/get-and-post- methods/
  • 7. The $_REQUEST Variable  The contents of $_GET and $_POST are available in $_REQUEST. Besides this, $_REQUEST also contains data associated with $_COOKIE> The form data sent to the webserver using both the methods namely GET and POST can be accessed by accessing this variable.  Here $_PHP_SELF variable contains the name of the self script in which it is being called. https://phpgurukul.com/get-and-post- methods/
  • 8. For More Info Visit: https://phpgurukul.com/get-and- post-methods/ https://phpgurukul.com/get-and-post- methods/