hallo,

I would like to create session system:

page1.php

<?php

session_start();

?>
<p><div style="margin: 50px 0 0 240px;"><img src="../../images/<?php echo $_SESSION['$banner']; ?>"></div></p>

It already works!

After I click the page2.php through the navigation, then:
I wonder why the banner that appears different from page1.php, I thought it suppose to be the same.

In which script do you set the value for this session index?

Also: do you know that using single quotes will NOT return the value of a variable? If you do:

echo '$banner';

You get $banner, literally. While using double quotes you get the value of the variable, if this is set. If you don't have any special reason to use $ in front of the index name, then avoid it, otherwise you can generate errors.

You start the session, but did you save the value in your session as well? You could take a look at this site as an example...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.