[thelist] Setting PHP variables...
Dave Stevens
evolt at davestevens.co.uk
Wed Apr 23 10:59:38 CDT 2008
Tris wrote:
> However on this server, I was getting error messages stating that the
> variable was not set.
...
> 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...
Are you attempting to use a variable that has not been set yet, or do
you mean you are getting these errors when you first assign a value to a
variable?
Example:
<?php
echo "My value is $variable_value"; // This gives an error as
$variable_value is not set
$variable_value = "now set";
echo "My value is $variable_value"; // This outputs My value is now set
?>
OR
<?php
$variable_value = "first time for everything"; // You get an error
message here?
?>
Dave
More information about the thelist
mailing list