Passing Session data between pages

Permalink 1 user found helpful
I've added a form as a Single Page so it shows up at mysite/index.php/orderform/

The processing for the form is done in another php file (process.php) and results are kicked back to the orderform page in $_session data.

It all worked perfectly fine outside Concrete- orderform.php and process.php lived in the same directory and could pass session data back and forth no problem.

Now, though, the session data doesn't seem to pass between the two pages. The forms on orderform.php (now index.php/orderform/) send $_post data to process.php but don't send the $_session data. process.php does what it's supposed to do and kicks back to orderform.php (via header() redirect) but no $_session data is retained.

How can I achieve what I'm trying to do?

AltaPlanning
 
myregistration replied on at Permalink Reply
The session id is stored in a cookie variable named CONCRETE5

Set the session id and then start the session, it must be in that order.

session_id($_COOKIE['CONCRETE5']);
session_start();
Fernandos replied on at Permalink Reply
Fernandos
Hi! :)

This might be usefull for many of you searching for session in the forums.

Just use this code

<?php
/** I don't think this is needed, because 
*   it's been loaded on startup everytime
*/
//session_name(SESSION);
//session_start();
?>
<?php
/** If we send data with post
*   save and update the sessiondata
*/
if(!$_POST['test'] == '') {
    $_SESSION['name'] = $_POST['test'];
    $sesion_data = $_SESSION['name']; 
}
Remo replied on at Permalink Reply
Remo
Setting the session_name is needed in some cases. When you try to include a 3rdparty script which you isn't processed by c5's index.php you have to set the session_name manually....
Fernandos replied on at Permalink Reply
Fernandos
Hi, Remo :)

You mean when you php include() them, but if you include it the c5 way, I mean with the Loader::function() is there any need?

I've written a booking app and needed sessions , it worked without telling the session_name everytime.. idk but I never needed more than $_SESSION[] within c5.
Remo replied on at Permalink Reply
Remo
you don't... But look at my sql buddy addon, there I don't execute c5 code, I use an iframe and if I want to access the c5 session I must set the session name and start it manually..

In about 98% of all situations you don't have to do anything. Luckily you're part of the 98% majority ;-)
CodeOtaku replied on at Permalink Reply
CodeOtaku
Cheers dude, your tip helped me a lot with linking to another script and checking that the user had logged into C5 :)
jayrich replied on at Permalink Reply
jayrich
no luck here. sessions are just not the best way to solve these problems then?