Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Session loses values when inserting <img> attributes

trying to insert an img tag with many attributes



5:35 pm on Jun 28, 2007 (gmt 0)

10+ Year Member

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,


8:38 am on Jun 29, 2007 (gmt 0)

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

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?



1:36 pm on Jun 29, 2007 (gmt 0)

10+ Year Member

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!


Featured Threads

Hot Threads This Week

Hot Threads This Month