home

Php Get Tutorial


GET is the method used by the browser to request normal web pages, but it can also be used to submit form data. Type a search term in to Google and hit search - notice how the results page has your query encoded in to the URL shown in your browser's task bar.

GET is ideal for applications like search engines where is useful to bookmark the resulting page. You will be able to do it as the browser will append a query string (a string made of key-value couples) to the URL.

GET is limited in that it can only handle small amounts of data.

Variables sent to a PHP script using the GET method are made available to your program as items in the $_GET global array. For example, data from a text field <input type="text" name="firstname"> sent using GET will be available to your program as $_GET['firstname'] .

 

From a query string like:

www.myscript.php?name=john&surname=doe

you will be able to fetch parameters printing the $_GET array

<?php
   echo "<pre>";
print_r($_GET);
echo "</pre>";
/* this will be the content of $_GET
Array ( [name] => john [surname] => doe )
*/
?>

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player

Copyright © 2014 by Cramerz.com.