Results 1 to 8 of 8
-
07-30-2003, 04:09 PM #1WHT Addict
- Join Date
- Jul 2002
- Posts
- 148
REALLY basic PHP question about functions
Hello
If I enter the following URL:
http://www.myserver.com/auction.php?searchterm=mac
That means, the funciton "auction.php" will be executed, and pass the term"mac" as $searchterm
Is that right?
-
07-30-2003, 04:12 PM #2WHT Addict
- Join Date
- Jul 2002
- Posts
- 148
If register_globals are On, yes.
If register_globals are Off, no:
$searchterm = $HTTP_GET_VARS["searchterm"];
-
07-30-2003, 05:25 PM #3Web Hosting Master
- Join Date
- May 2002
- Location
- UK
- Posts
- 2,997
If you are using PHP4.1.0 or newer you should try to always to program with the super global arrays
$_GET['searchterm']
as HTTP_GET_VARS is a deprecated method which means now that they have warned you they could remove it from the language whenever they felt like it.
-
07-30-2003, 06:55 PM #4WHT Addict
- Join Date
- Jul 2002
- Posts
- 148
Thanks,
If I'm running Mac OS X and Apache with PHP,
how do I turn this feature "ON"
Thanks!
-
07-30-2003, 08:01 PM #5New Member
- Join Date
- Jul 2003
- Posts
- 4
Originally posted by kenfused
Thanks,
If I'm running Mac OS X and Apache with PHP,
how do I turn this feature "ON"
Thanks!
http://site.com/index.php?action=load
The action variable will have to be accessed by using for example $_GET['action']
-
07-30-2003, 09:30 PM #6Newbie
- Join Date
- Jul 2003
- Posts
- 7
optionally for the lazy and those not worried about their security the extract() function is readily available.
PHP Code:extract($_REQUEST);
-
07-31-2003, 12:58 AM #7WHT Addict
- Join Date
- Jul 2002
- Posts
- 148
Thanks!
-
08-01-2003, 02:51 PM #8WHT Addict
- Join Date
- Apr 2002
- Location
- Philly Pa
- Posts
- 130
function register_globals() {
if (!ini_get('register_globals')) {
$__am = array(&$_COOKIE, &$_POST, &$_GET);
while (list(,$__m) = each($__am)) {
if (is_array($__m)) {
$GLOBALS += $__m;
}
}
}
}