PHP GET method



Αξιολόγηση Χρήστη:  / 2
ΧειρότεροΚαλύτερο 
Λεπτομέρειες
Κατηγορία: php
Δημιουργηθηκε στις Τρίτη, 11 Δεκεμβρίου 2012 14:55
Τελευταία Ενημέρωση στις Τρίτη, 11 Δεκεμβρίου 2012 14:56
Δημοσιεύτηκε στις Τρίτη, 11 Δεκεμβρίου 2012 14:55
Γράφτηκε από τον/την Administrator
Εμφανίσεις: 8303

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