?
Solved

cannot store / write sessions

Posted on 2008-06-16
2
Medium Priority
?
191 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

762 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