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

tell me ?

thanks and advanced.

Recommended Answers

All 2 Replies

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.

Member Avatar for diafol

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.