Hi, I was curious if anyone knew how to start a session from the webform, and post the session data on a redirect page in a hidden form.

When starting a session, is there anything I need to do other than activate the php filter module, and select it as the input type?

Does drupal automatically start a session? or do you have to start it in each php snipp.

How can I tell if the session data is being saved on the server?

Are these questions to advanced for me, and if you need to make a buck I'll try to get you something, in cash or trade for your help.

I have the basics from this thread: http://drupal.org/node/275857#comment-2818004

But I am getting no results using the last post one listed. I posted on that thread as well, but am in a pinch and if anyone can help me out I'd appreciate it.

Comments

irishjays’s picture

An example:

<?php
$component_key = 'first_name';
$component_cid = 6;

// The First Name field is within a fieldset for "Name".
// Updating this value will set the first name to to "Bob" in the e-mail.
$form_values['submitted_tree']['name'][$component_key] = 'Bob';

// Despite the field being in a fieldset, in the submitted array,
// it is identified directly by the component CID.
// Updating this value will set the the first name to be "Joe" in the database.
$form_values['submitted'][$component_cid] = 'Joe';
?>

or if you just wanted to set the value to a php variable:

<?php
$first_name = $form_values['submitted_tree']['first_name'];
$last_name= $form_values['submitted_tree']['last_name'];
?>

This snippets are only intended for use with the Webform 2.x module. They will not work with CCK or other modules.

According to that from the webform doc, I should be fine no matter the fieldset i'm in. However it's not posting or printing. So I suppose the problem is either, I don't have drupal configured correctly to use session data. Is there a way to see what session data I have stored?

irishjays’s picture

I called all the session info:

<?php
echo "dumping SESSION<br/>";
var_dump($_SESSION);
echo "<br/><br/>";

echo "dumping GLOBALS<br/>"; // i have seen this in their code
var_dump($GLOBALS);
echo "<br/><br/>";

echo "dumping COOKIES<br/>"; // just to check cookies as well
var_dump($_COOKIE);
echo "<br/><br/>";

And searched through it and didn't find the session infor from my webfor additional processing. Anyone know what I'm missing? Is it something I need to enable in settingsphp?

irishjays’s picture

I used this test to see if session data was saving:

http://petermoulding.com/how_to_carry_data_from_one_page_to_another_usin...

It saved. and I was able to see the data in the return from: <?php
echo "dumping SESSION
";
var_dump($_SESSION);
echo "

";

So let's look at that code a little more...

irishjays’s picture

The only problem I found was the fact that I created the webform before allowing the php filter? Could that be it, because I cloned and recreated and it worked fine? I spent 4 hours trying to figure it out. I still don't know.