PHP GET method



User Rating:  / 2
PoorBest 
Details
Category: php
Created on Tuesday, 11 December 2012 14:55
Last Updated on Tuesday, 11 December 2012 14:56
Published on Tuesday, 11 December 2012 14:55
Written by Administrator
Hits: 5413

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.

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();
  }
?>