Solved

cannot store / write sessions

Posted on 2008-06-16
2
187 Views
Last Modified: 2010-04-21
Hi

I'm trying to set sessions based on the post then use them later, any idea why this does not work.... and is this a security risk?

if it is a rick, are there better ways or something else I should add to check on

Thanks
Neil

session_start();
foreach ($_POST as $var => $val) {
   $_SESSION[$var] == $val;
   echo $_SESSION[$var];
}
0
Comment
Question by:Neil Thompson
2 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 500 total points
ID: 21793787
It is not a securiry risk per say.

As your example. You have a equal sign to many. It should be:
session_start();
foreach ($_POST as $var => $val) {
   $_SESSION[$var] = $val;
   echo $_SESSION[$var];
}
0
 
LVL 3

Author Closing Comment

by:Neil Thompson
ID: 31467606
thanks
Neil
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now