Hi all...
I'm fairly new to PHP, and for some time now, I've had a problem deciding how to transfer variables between pages, and finally i settled for using session variables for this... I'm not sure if it's the best way to do it, for the purposes I have, and if you got some better way please advice me. But, anyway, this is how I've tried to do it:
in globals.php, I have declared this function:
function ses_var($var,$def) {
if (!isset($_SESSION[$var]))
{
$_SESSION[$var] = $def;
}
$var = $_SESSION[$var];
return $var;
}
in variables.php i use it:
ses_var('style','def');
and in index.php i have this:
<style type="text/css" media="screen">
<?php include("style/".$style.".css") ?>
</style>
both globals.php and variables.php are, of course, included first in index.php.
My problem is that the variable $style is empty, or undeclared, so it keeps looking for style/.css, instead of style/def.css, as it should... What's my problem? How should I do this?
Thanks
-Matt