close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Losing session variables on subsequent pages

Thread began 3/04/2016 2:56 pm by LionsMane | Last modified 3/24/2016 2:02 pm by Ray Borduin | 611 views | 6 replies |

LionsMane

Losing session variables on subsequent pages

Any session variables stored by your mySQLi behaviors get stored in the browser as expected. However, any sessions store on a given page using typical PHP code method ($_SESSION['ReturnAID'] = $User->getColumnVal("AID"); .. for example) store fine and can be echoed on the page, but as soon as I go to the next page (which also contains the mySQLi behavior to build a recordset filtering on that session variable) comes up blank. I can echo the variable on the secondary page, and it's empty! Like it's dropping that value after the transition - though the mySQLi stored sessions are definitely still there! Any ideas???

Side note, even if I set the session variable to a hard-coded value, it's still being dropped on the next page. We customized your included mySQLi support obj files on this site, and I'm hoping something we did didn't kill this function???

Sign in to reply to this post

Ray BorduinWebAssist

You may need to add this to the top of the page before referencing session variables:

<?php
@session_start();
?>

Session variables will appear blank until the session is started.

Sign in to reply to this post

LionsMane

already the case, yes?

Hi Ray, you built that into your mySQLi files already though, yes? As long as any of your mySQLi behaviors are applied to the page, session support should already have been started, yes?

Sign in to reply to this post

Ray BorduinWebAssist

Our code will start the session, but it can close it after as well. It is suggested to close sessions when they aren't in use because it can speed up processing particularly when using AJAX. Try adding @session_start() above the line where you are setting your session variables. Maybe it is closed so they won't store properly.

Sign in to reply to this post

LionsMane

Thank you

That solved it. I'm not sure why setting session_start at the top of the page didn't fix it, but adding it in the same code where the variables are being set does. Any particular insight is appreciated.

Sign in to reply to this post

Ray BorduinWebAssist

I'm sure we are closing the session in the code above somewhere for efficiency. A single start will make all the session variables saved previously available on the page and the session can (and should) then be stopped if you aren't saving any more. If you are ever saving a session variable it is good to add a session start above and session_close() below.

Sign in to reply to this post

LionsMane

This post has been deleted.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...