Log in

View Full Version : $_Get abilities



Rockonmetal
09-12-2007, 06:09 PM
I know that when you use get method with forms it puts into the url... but what else can it do and what is it usefull for?

Thanks

Twey
09-12-2007, 06:18 PM
_GET isn't a method, it's a variable (as evidenced by the $ prefix) that stores an associative array. Nothing more.

boogyman
09-12-2007, 06:37 PM
a good thing to note on this variable is that there is a character limit cap, which is why it is suggested to use $_POST when sending something to the server-side, where $_GET is recommended to be used soley for data retrieval.

Rockonmetal
09-12-2007, 09:07 PM
So could I get data from a external file and analyze it? If thats not the command what would do that?

Like and example
The get command gets data from "data.txt"
Then it does some magic thing where it analyzes it and check to see if that name already exists or entry already exists...
Then based on the data it does something...

Could $_Get do that?

Twey
09-12-2007, 09:16 PM
No, of course not. _GET is named after the HTTP method GET, not its purpose. You probably want fread (http://www.php.net/fread)().

Rockonmetal
09-12-2007, 10:35 PM
ok thanks!

djr33
09-13-2007, 08:45 AM
$_GET is the array of values sent in the url, as ../index.php?var1=val1&var2=val2&var3=val3&etc

$_GET['var1'] is 'val1' in that case.

It's used as a way of sending between pages, either with a method="GET" form or a URL (link, the action of a POST form, image src, etc.). Note that a method="GET" form is just a way of using a form to generate a URL, not really sending any "form data" as such.

Rockonmetal
09-14-2007, 12:35 AM
ok... thanks!