Ad

get method php

             


What is the $_GET Method

$_GET is one of the main global variables in PHP. It is a combination of variables that are passed to the current version of the query string appended to the HTTP request URL. Note that this array is populated by each request with the query string appended to the GET request. In this case, the browser uses the HTTP GET method to send the request to the server's URL. The query string appended to the URL can have a key/value pair concatenated with the "&" symbol. The $_GET associative array stores these key/value pairs. If you are using XAMPP server on Windows, put the script as "hello.php" in the "c:/xampp/htdocs" folder.

Example :-

Source Code  :-

<html>
<body>
   <form action="text.php" method="get">
      <p>First Name: <input type="text" name="first"/></p>
      <p>Last Name: <input type="text" name="last" /></p>
      <input type="submit" value="Submit" />
   </form>
</body>
</html>

Output :-



Difference Between GET and POST in PHP 

 

              GET

 

              POST


 

Get method can be bookmarked

 

Post method cannot be bookmarked

 

Get method can be cached

Post method not cached

 

Get method parameters remain in browser history.

 

Post method are not saved in browser history.

Get method only ASCll  characters allowed

 Post method No restrictions Binary data also allowed.

 

Get method data is visible to everyone in the URL

 

Post method Data is not displayed in the URL

Get method has a length limitation of 255 characters.

 

Post method does not have a length limitation

Get method  requests are is more efficient and are used More than a post

 

Post method request is less efficient and used less than get

Get method  limited are the amount  of data can be sent because data is sent in header.

 

Post method  large amount of the  data can be a sent body

Get is less secure compared to Post because data sent is part of the URL

 

 Post is little safer than Get because the  parameters  are not stored is browser history

Related Post:-

php program to print alphabet pattern D

bdi tag in html

No comments

Powered by Blogger.