PHP GET method



User Rating:  / 2
PoorBest 
Details

There are two ways the browser client can send information to the web server.

The GET Method

The POST 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 produces a long string that appears in your server logs, in the browser's Location: box.
  • 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.
  • The data sent by GET method can be accessed using QUERY_STRING environment variable.
  • The PHP provides $_GET associative array to access all the sent information using GET method.

example:

html file : get.html

View source
<html>
<body>
  www.developerpages.gr <br><br>
  <form action="get.php" method="GET">
  First Name: <input type="text" name="firstname" /> <br>
  Last Name: <input type="text" name="lastname" /> <br>
  <input type="submit" />
  </form>
</body>
</html>
 

php file : get.php

View source
<?php
 
  if( $_GET["firstname"] || $_GET["lastname"] )
  {
     echo "Welcome "$_GET['firstname']"  "$_GET['lastname']"<br />";
     exit();
  }
?>




You have no rights to post comments

   

Login  

   

     

© Developerpages