When you use a form with the method GET, you will be able to send information (just like $_POST) to another page or itself. This information will be shown in the address bar. A little example of a URL with the GET method will be: http://domain/test2.php?text=This+is+information&number=2585
In this example we did send a form with 2 text fields with as name “text” & “number”. The value’s of those fields (Input by user) are shown in the URL.
test2.php?text=This+is+information
In the above part of the URL ‘test2.php’ will be the receiving page followed with a question mark which indicates that their are values here in combination with the GET method. The second part will be ‘text=This+is+information’! Here, the ‘text’ will be the name of the input field followed with a = sign which indicates that there is a value tagged to this field name which (in this case) is ‘This+is+information’.
This is just 1 value, the ampersand sign (&) indicates a second field, (in this case) the number field with as value 2585. Go on, go on, and go on.
The above example is done with the following 2 little example scripts
Page with form!
<form method="get" action="test2.php"> <input type="text" name="text" /> <input type="text" name="number" /> <input type="submit" value="Do!" /> </form>
Receiving page! (test2.php)
// Get the value's with the GET method. $text1 = $_GET['text']; $text2 = $_GET['number']; echo 'You did send: '. $text1 .' & '. $text2 .' to this page';
Mail this!
- Comments (0)
- PingBacks (0)
- TrackBacks (0)


» Latest comments