# Php sessions not working

**URL:** https://forum.kirupa.com/t/php-sessions-not-working/253552
**Category:** Uncategorized
**Created:** [March 3, 2008, 12:16am UTC](https://forum.kirupa.com/t/php-sessions-not-working/253552 "2008-03-03T00:16:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![shujinn](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@shujinn](https://forum.kirupa.com/u/shujinn)
#### Post date: [March 3, 2008, 12:16am UTC](https://forum.kirupa.com/t/php-sessions-not-working/253552/1 "2008-03-03T00:16:28Z")

</div>

Hi Guys,

I’m trying to set a session variable that changes the BG style of a page.  
And the php is just totally not working, Any help would be greatly appreciated.  
Here is the code.

\*\*HEADER  
\*\*\<style\> \<?php  
session\_start();

if(isset($_SESSION[‘bg’]))  
echo "body{  
background-image: url(img/bg_" . $\_SESSION[‘bg’]; . “.jpg);  
}”

else  
print “body{  
background-image: url(img/bg\_1.jpg);  
}”

?\>  
\</style\>

\*\*HLINKS  
\*\*\<a href="#\<?=$\_SESSION[‘bg’]=‘1’; ?\>"\>1\</a\>  
\<a href="#\<?=$\_SESSION[‘bg’]=‘2’; ?\>"\>2\</a\>  
\<a href="#\<?=$\_SESSION[‘bg’]=‘3’; ?\>"\>3\</a\>

Thanks.
