Page 1 of 1

[SOLVED]How do I not use register_globals?

Posted: Fri Aug 04, 2006 12:07 am
by Locust
I'm quite used to using register globals. Often having links such as index.php?action=logout

I mainly like this because you can perform many actions without having to leave the page you're on (i.e. having to go to logout.php)

Should I be doing something else? Is there a better way without having to go to other pages?

Posted: Fri Aug 04, 2006 12:08 am
by feyd
$_GET['action']

Posted: Fri Aug 04, 2006 12:10 am
by Benjamin
You can access the variables in the URL with:

Code: Select all

$VariableName = $_GET['VariableName'];
If that is what your asking. Also look at $_POST

Posted: Fri Aug 04, 2006 12:11 am
by Locust
I use $_POST with all my forms and never really used $_GET because I didn't see a need for it... now I do :) Thanks guys.

Posted: Fri Aug 04, 2006 12:14 am
by nickvd
http://example.com/index.php?this=that& ... =other_one

Code: Select all

var_dump($_GET);
Will give you:

Code: Select all

array(3) {
  ["this"]=>
  string(4) "that"
  ["lets_not"]=>
  string(6) "forget"
  ["the"]=>
  string(9) "other_one"
}
The same will apply with your forms, which can be accessed via $_POST. Check out the following pages at php.net for further knowledge.

http://php.net/manual/en/language.varia ... efined.php
http://php.net/register_globals



... bah, too slow... :oops: