homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Session loses values when inserting <img> attributes
trying to insert an img tag with many attributes

10+ Year Member

Msg#: 3381374 posted 5:35 pm on Jun 28, 2007 (gmt 0)

Hello to all people of good will and better knowledge:)

On one page I insert into $_SESSION at 'mykey' a value:

<div id="wrap_0" class="main6"><div onclick="parent.load_pic('foto_0', 'wrap_0')" id="foto_0"><img alt="image" src=""/></div><div class="sp1a">ccccccc</div></div>

It comes from a form and is assigned as usual:

And on another page when I start the session and try to read the $_SESSION array the $_SESSION['mykey'] is empty.
All the other values set elsewhere are right there.

I tried addslashes(), htmlentities() but nothing works. To my surprise it doesn't work in FF, in IE it's ok.

Any idea? Thanks in advance,



WebmasterWorld Senior Member dreamcatcher us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 3381374 posted 8:38 am on Jun 29, 2007 (gmt 0)

Hi Joey_33,

Have you checked that the session var is being populated on the first page? Is the problem on that page rather than when the data is accessed on the next page? Try using this directly after you set the var:

echo '<pre>';
echo '</pre>';

Are you using session_start() at the top of all your pages?



10+ Year Member

Msg#: 3381374 posted 1:36 pm on Jun 29, 2007 (gmt 0)

Yes, I start session on page 2 and just this key in session array is empty. Maybe I put the problem too simple.

The long string comes from an iframe on page 1 generated by JS after inserting in image in wysiwyg editor. If you feel like looking into the problem to avoid potential future problem let me know, I'll post codes and describe the problem in detail.

As for now, I went round this problem inserting src attribute at a later stage and it works.

Thanks for your interest and help DC!

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved