How to show selected image on another page?

Hello everyone, I have a small problem that seem too large for me to figure out. I been at it for hours.

User log in using page 1 … all is well!
User is taken to page 2 … The Welcome page. It has this code:


<?php
  if ( isset($_SESSION['favorite_logo'])){
//     print "Your favorite logo selected is $favorite_logo<br>";
     $logo = $_SESSION['favorite_logo'];
     print "Your favorite logo selected is $txtCode<br>";
  }
?>

The User click to go to Page-3 to select from dropdown list his favorite Image for his logo. Here is some of Page-3 code:


<form method="post" name=Logo_Form action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table cellSpacing=1 cellPadding=1 width=800 border=0>
<tr>
<td align=right><IMG alt="" src="" id=imgFlag style="VISIBILITY: hidden"></td>
<td>
<select id="logo" name="logo" size="1" value="" onChange='ShowFlag()'>
<!--[OPTIONS]-->
<Option value="L1" SELECTED>Sport Cars</option>
<Option value="L2">Nature</option>
<Option value="L3">Sail Boat</option>
</Select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td><INPUT name="txtCode" onFocus="this.blur();"></td>
</tr>
<tr>
<td></td>

It use javascript and the desired image is shown next to the dropdown box for each selection. So it do works for page-3 but only halfway for page-2 . The goal is to show the name and image on Page-2, the Welcome page.

It will print to page-2 the name of the image but it will not show the .png image. What am I’m missing or what have I done wrong?

Thanks in advance for any help

I assume you’ve session_start’d on ALL pages.
Where’s the form-handling code in page 3? Javascript cant write to PHP’s session variables.

It’s not totally clear to me what you are trying to do.

But as an option, in your onchange event handler ShowFlag() fire off an ajax request to the server to update a session variable which stores the path name to the selected image. Then on every other web page you can access that session variable to display the image on that page.

Did you echo/print the favourite logo into an img tag on page 2?

It’s hard to diagnose Page 2 problem without seeing the code.