Saturday, December 24, 2011

Get Method in PHP

What is GET Method?
   The GET method passes arguments from one page to the next as part of the Uniform Resource Indication(URI) querystring. When used for form handling, GET appends the indicated variable name(s) and value(s) to the URL designated in the ACTION attribute with a question mark separator and submits the whole thing to the processing agent.


Example
<html>
<body>
  <form action="<?php $_PHP_SELF ?>" method="GET">
<?php
  if( $_GET["name"] || $_GET["age"] )
  {
     echo "Welcome ". $_GET['name']. "<br />";
     echo "You Rollno is. ". $_GET['rollno']. ";
     exit();
  }
?>

  Name: <input type="text" name="name" />
  Age: <input type="text" name="rollno" />
  <input type="submit" />
  </form>
</body>
</html>

For post method with difference: Click to View

No comments:

Post a Comment