RE: [PHP] Some discoveries I've made. Anyone care to confirm/deny
| From: | Ford, Mike [LSS] | Date: | Fri, 20 Dec 2002 10:52:10 +0000 |
| Subject: | RE: [PHP] Some discoveries I've made. Anyone care to confirm/deny | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-128968@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Sean Malloy [mailto:sean@element.net.au]
> Sent: 19 December 2002 23:30
>
> Firstly, something regarding accessing form/query string variables, on
> diffferent versions of PHP. Starts to become a nightmare, but
> you also want
> to make sure you _aren't_ requiring register_globals to be on...
>
> so what I do;
>
> function Form($var = null)
> {
> if (function_exists('version_compare')) // added in 4.1.0
> {
> return @$_POST[$var];
> }
> global $HTTP_POST_VARS;
> return @$HTTP_POST_VARS[$var];
> }
This seems unnecessarily complex -- $HTTP_*_VARS did not go away when the new $_* superglobals were
introduced, and are not likely to anytime soon, so the simple way to do this is just to continue
referring to $HTTP_POST_VARS[$var].
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211