View Single Post
  #2 (permalink)  
Old January 1st, 2005, 02:06 PM
Snib Snib is offline
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Please explain in more detail, or give some of your code.

So, when you try to echo the value at the end, it returns undefined?

Perhaps it is in a function. With a function you must declare that the variable is global, at the beginning of the function.

Code:
$var1 = "hello";

function sayHello()
{
  echo $var1; //will give an undefined notice
}

function globalHello()
{
  global $var1;
  echo $var1; //will give "hello"
}
-Snib - http://www.snibworks.com
Where will you be in 100 years?