Hi
I am calling a php script to randomly select images and apply the images to the background of a div as such:
#mydiv {
background: url(myscript.php);
}
This works great however, within the 'myscript.php' script, I store the name of the image to a session variable but I cannot access this session variable from any web page on my site - which is my overall aim. (session_start() is placed on all pages).
Is the reason for this because I am executing the script via CSS? If anyone has any ideas then I'm all ears!
Here is my web page code. You can see I am trying to echo the session variable after the stylesheet is included.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<?php
$_SESSION['S_NEW_IMAGE'] = !empty($_SESSION['S_NEW_IMAGE']) ? $_SESSION['S_NEW_IMAGE'] : NULL;
?>
<link href="/css/global.css" rel="stylesheet" type="text/css" media="screen" />
<?php echo "File:" . $_SESSION['S_NEW_IMAGE']; ?>
<title>My Site</title>
</head>