0

hi
any body tell me where use in PHP this function $_GET on websitedesign and why I use this.

tell me ?

thanks and advanced.

Edited by dornaled: n/a

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by diafol
0

It's not a function, but a reserved variable in php.

Basically, when you set the method of your form output as "get" instead of "post", you can use this variable to retrieve the form contents.

If your html contained:

...
<form action="process.php" method="get">
<input type="text" name="email" />
<input type="submit" name="submit" value="Submit" />
</form>
...

...and let's say a visitor on your site typed in their email and pressed submit. At this point, the contents of the form are sent to "process.php". Let's just make it simple and have it echo the data back to the visitor.

process.php

<?php

echo "The email you entered was ", $_GET['email'], ".";

?>

You can find a more detailed description here: http://php.net/manual/en/reserved.variables.get.php Hope this helps.

0

As WM says. Data also taken from url querystrings:

mypage.php?i=6&x=8

$_GET //this is 6
$_GET //this is 8

I wouldn't use get for forms unless you're creating a search engine maybe. I think urls are limited to 255 chars (http://en.wikipedia.org/wiki/Query_string#Compatibility_issues)? I may be wrong, but anyway, sending form data by get may mean that your data is cut off at the knees.

Edited by diafol: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.