RE: [PHP] undefined variable: action
| From: | Ford, Mike [LSS] | Date: | Thu, 12 Jun 2003 09:28:57 +0000 |
| Subject: | RE: [PHP] undefined variable: action | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-151215@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Ryan M [mailto:montessman42@shipright.net]
> Sent: 11 June 2003 20:22
>
> Thanks for the advice... The link worked.... Now it is saying this:
>
> Notice: Undefined index: action in....
>
> It only says this if there is no action...it goes away once I
> click the link
> and the action=someaction.... Is there a way to fix my php
Simplest way to fix this is to use the @ silence operator:
@$_GET['action']
will return NULL if $_GET['action'] is undefined.
> so
> that I dont
> have to change all of the web sites hosted on my server?? Thanks!
The only way to do that is to reduce the error reporting level to not include E_NOTICE. Ideally,
you should run a development server which has error reporting set to E_ALL, and only copy scripts to
your production server once they produce no messages at this level -- your production server can
then run with a reduced error reporting level (even down to none at all, if you feel confident about
that ;). Ideally, if your production server does run with no error reporting, you should have error
logging enabled as a safety net!
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