[thelist] Setting PHP variables...

Tris beertastic at gmail.com
Wed Apr 23 03:29:11 CDT 2008


Hi all...
I'm on site this week and working on a project that the server has
Global Variables turned off(I know I know, I SHOULD be doing that by
default..!)

Anyhoo, When I needed something dynamic, I simply did:
if (isset($_SESSION["userId"])) {
  $showMessage = "welcome";
}

However on this server, I was getting error messages stating that the
variable was not set.

If I added a blank variable at the top of the code ' $showMessage = "";  '
that 'fixed' the big.
However, now I have a list of about 30 variables at the top of my code
and it looks untidy.
There must be a better way to say to the server:
if I asign a value to a variable, presume it exists.

This only occurs when the main page requests a variable (eg
$showMessage ) and it's not ben asigned..
on other servers, it has just simply shown nothing, cause nothing was found...

Am I being a tool?

Tris...



-- 
"The only people who don't make mistakes are those who don't do anything"

Give a man a fish and he'll feed himself for a day.
Give a man a religion and he'll starve to death praying for a fish.
Anon

`We are what we pretend to be, so we must be careful what we pretend to be.`
Kurt Vonnegut

`When a person can no longer laugh at himself, it is time for others
to laugh at him.`
Thomas Szasz



More information about the thelist mailing list