close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Passing data between pages with $_SESSION

Thread began 10/19/2019 5:24 pm by Stan | Last modified 10/21/2019 8:58 am by Ray Borduin | 347 views | 1 replies |

Stan

Passing data between pages with $_SESSION

I am having difficulty with this. To test I made two simple pages passing data from one to the next.

Page one.
<?php
session_start();
echo session_id();
// Set session variables
$_SESSION["favcolor"] = "green";
$_SESSION["favanimal"] = "cat";
echo "Session variables are set.";

Page two.
session_start();
echo session_id();
// Echo session variables that were set on previous page
echo "Favorite color is " . $_SESSION["favcolor"] . ".<br>";
echo "Favorite animal is " . $_SESSION["favanimal"] . ".";

Result:
23349bac5fa1be24474c67a02d4cbc7b
Favorite color is .
Favorite animal is .NULL

The session ID is the same on both pages. What else should I be checking?
Thank you

Sign in to reply to this post

Ray BorduinWebAssist

It could be an issue with the session_save_path in the php.ini file. If it is set to a bad directory that either doesn't exist or the permissions don't allow read/write access, then the session variables won't be saved properly.

Sign in to reply to this post
Did this help? Tips are appreciated...

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...