Re: undefined variable: action

From: Date: Wed, 11 Jun 2003 20:40:56 +0000
Subject: Re: undefined variable: action
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-151141@lists.php.net to get a copy of this message
Or you can simply turn off NOTICE error reporting in the php.ini file or use ini_set or error_reporting() to not include notices. This should not affect functionality. --- Lars Torben Wilson <torben@php.net> wrote: > On Wed, 2003-06-11 at 12:22, Ryan M wrote: > > 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 so > that I dont > > have to change all of the web sites hosted on my server?? Thanks! > > > > Ryan > > Check and initialize your input variables: > > if (!isset($_GET['action'])) { > $action = ''; > } else { > $action = $_GET['action']; > } > > switch ($action) { > case 'something': > do_something(); > break; > case 'something_else': > do_something_else(); > break; > default: > echo "Unrecognized action given"; > break; > } > > If this is something you need to do for every page on your site, > put > the if() check into an auto-prepended file or something. > > > Hope this helps, > > Torben > > > -- > Torben Wilson <torben@php.net> > +1.604.709.0506 > http://www.thebuttlesschaps.com > http://www.inflatableeye.com > http://www.hybrid17.com > http://www.themainonmain.com > -----==== Boycott Starbucks! http://www.haidabuckscafe.com > ====----- > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ===== Mark Weinstock mark_weinstock@yahoo.com *************************************** You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. *************************************** __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com

« previous php.general (#151141) next »