$_GET variable

The GET method used to send data to the server. When we submit a form, that has the GET method it displays pair of name or value used in the form at the address bar of the browser preceded by url. GET method is limited we can not send more data.

$_GET Example :


<form action="method_get.php" method="get">
<p>
Email address:
<br />
<input type="text" name="email" size="20" maxlength="60" value="" />
</p>
<p>
Password:
<br />
<input type="password" name="pswd" size="20" maxlength="15" value="" />
</p>
<p>
<input type="submit" name=" login" value="login" />
</p>
</form>

Output:

Email : tutorialsscripts.com
Password : get

Here GET method is used to control the form values. When we submit button is clicked, the form data will be send to method_get.php file because this is the file name mentioned in the form action part. Form is submitted when the user clicks the "Submit" button, when PHP GET method is used then the URL will not contain any form data, the URL will be passed as such. Here URL will be

http://www.tutorialsscripts.com/method_get.php?email=get@tutorialsscripts.com &pswd =get

The $_GET Variables by default is the only way that you can access variables passed via the GET method. You cannot reference GET variables like this: $cat, $id.





Content