Darren,
Thanks for the tip on direction to head in. Could you provide an example of
what you are referring to?


"Darren Gamble" <[EMAIL PROTECTED]> wrote in message
078EC26E265CD411BD9100508BDFFC860ED3E64E@shawmail02">news:078EC26E265CD411BD9100508BDFFC860ED3E64E@shawmail02...
> Good day,
>
> Just to clarify, Perl will, in fact, complain if you have undefined
> variables (or variables that you use once) if you have warnings and/or
> strict mode in effect.  Using at least one is strongly recommended.
>
> In PHP, the method you're using for getting form data is deprecated.  You
> should use $HTTP_POST_VARS or $_POST, depending on your version.  Check
the
> docco for more info on those.
>
> If you really have to check variables using this method, use isset() to
see
> if the variables ... have been set. =)
>
> ============================
> Darren Gamble
> Planner, Regional Services
> Shaw Cablesystems GP
> 630 - 3rd Avenue SW
> Calgary, Alberta, Canada
> T2P 4L4
> (403) 781-4948
>
>
> > -----Original Message-----
> > From: Crane, Christopher [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, May 30, 2002 3:07 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: [PHP] Undefined variables
> >
> >
> > I have an annoying problem, that I know is my own ignorance
> > to PHP. I came
> > from PERL and this was not a problem there but is with PHP.
> >
> > Here's the issue.
> > I have a number of scripts that use a "index.php?Task='some
> > sort of task
> > name'", for example, http://www.foo.com/index.php?Task=ShowVersion
> > <http://www.foo.com/index.php?Task=ShowVersion> .  Then I use
> > an if/else
> > statement to tell the script what to do if it sees the
> > ShowVersion variable.
> > In the ShowVersion example, I would call a function that displays the
> > version information I defined in the script. As a back up, I
> > always provide
> > an else statement to catch variables I have no functions for.
> >
> > If I have a ShowVersion function, GetData function and a CreateImage
> > function and the Task variable is empty or a variable that
> > does not exists
> > comes in like http://www.foo.com/index.php?Task=SomethingDumb
> > <http://www.foo.com/index.php?Task=SomethingDumb>  it would go to the
> > default function of something by using the ELSE part of the if/else
> > statements.
> >
> > I hope I am describing this correctly.....now here is the
> > problem. If I have
> > warnings turned on, or if I have a log written for warnings,
> > the log fills
> > up if someone goes to http://www.foo.com/index.php
> > <http://www.foo.com/index.php>  or http://www.foo.com
> <http://www.foo.com>
> will error messages like undefine variable TASK on line 255. I understand
> the reason, that PHP was expecting the variable Task when it got to the
> if/else statements. So I put in something like if(!($Task)) { function
> Something(); } but it still is looking for the variable so it still
errors.
>
> In Perl, it would simply be ignored. What do I do here.
>
> Here is a simple example of the code.
>
> if ($Task == "ShowVersion") { function ShowVersion(); }
> elseif ($Task == "GetData") { function GetData(); print "$DataOutput"; }
> elseif ($Task == "CreateImage") { function CreateImage(); }
> else { print "Incorrect Variable or no Variable Supplies<br>"; }
>
>
>
>
>
> Christopher J. Crane
> Network Operations Manager
>
> IKON Office Solutions
> 860.659.6464
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to