Re: switch query (or may be I have done something wrong)
| From: | Christoph Grottolo | Date: | Mon, 28 Apr 2003 11:30:15 +0000 |
| Subject: | Re: switch query (or may be I have done something wrong) | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-19650@lists.php.net to get a copy of this message | ||
caspar@thetuckshop.com (Caspar Kennerale) wrote:
>I recently updated to PHP 4.3.1 on my windows maching running at home
>
[...]
>Different pages are called via a switch for example
>
>http://localhost/admin/admin.php?action=add_default
>
>admin.php being a file whoch contains the switches like this
>
><?php
>
>switch($action) {
> case "add_default":
[...]
>The problem is that whenever I request any of the swtiches (there are 10 of
>them) the page only returns the default.
[...]
Probably you didn't notice that GET and POST vars are no more
registered directly in the global namespace unless you specify
'register_globals' in php.ini (which is usually not a good idea).
You should refer to $action as $_GET['action'].
See also www.php.net/globals
HTH,
Christoph