?
Solved

cannot store / write sessions

Posted on 2008-06-16
2
Medium Priority
?
193 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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month14 days, 7 hours left to enroll

807 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