SESSION variables and multi-part...

User 10077 Photo


Senior Advisor
1,095 posts

In another thread, Eric posted about how WFB stores form results in a SESSION variable.

<?php
$post = $_SESSION['post']; // This is getting the post array
$number = $post['number']; // This is getting my number input name from the array called "number"
$dropdown = $post['dropdown']; // This is getting my dropdown name from the array called "dropdown"
// Add more as needed for each input on your form. Adjust to your input name.

Can this be applied to a multi-part form?

Let's say Form1 collects their name and then redirects to Form 2. Form 1 variables are stored in $_SESSION['post'] and can be displayed on another page.

session_start();
// POST FROM FORM1
$post = $_SESSION['post']; // This is getting the post array
echo $post['name'].'<br>';


Form2 collects their address and phone numbers. When submitting Form2, will it simply add the additional variables to $_SESSION['post']?

I tried this, and so far I've not been able to get it to work. When I try to echo the results, the new fields that should be in the SESSION have no data.

session_start();
// POST FROM FORM2
$post = $_SESSION['post']; // This is getting the post array
echo $post['address'].'<br>'.$post['city'].', '.$post['state'].' '.$post['zip'];


I'm wondering if someone has additional input to point me in the right direction.
ASK ME ANYTHING
I provide personalized help for Coffeecup Users including training for Site Designer and Web Form Builder via Zoom.
Email me at support@usconsumernet.org or call 865-687-7698.

Did you know that Web Form Builder can be used for both simple and complicated forms and that it's not limited to the default fonts and buttons? Take a look at a form we developed for WindowTinting.com.
https://forms.windowtinting.com/forms/w … ppingcart/
User 187934 Photo


Senior Advisor
20,181 posts

I think what you have happening is that the form builder is unsetting the post array when you go to the second form. Just like refreshing the page. Try going directly to formname2.html.
You could also try changing the name of the $_SESSION['post'] going directly to the page with the form iframe code .
$_SESSION['newpost'] = $_SESSION['post'];

The formbuilder doesn't use session_destroy();
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 10077 Photo


Senior Advisor
1,095 posts

In my first attempt, I linked directly to Form2.php, and it correctly displays some of the data from Form1 on the page, so I know the Session is still valid.

After Form2 submission, the fields that Form1 and Form2 have in common are still in the session. The new fields from Form2 are not there. You bring up a good point. Perhaps Form2 can't write more data to the session. Therefore, as you said, I could do something like this.

// After Form 1 submission
$_SESSION['newpost'] = $_SESSION['post'];
unset($_SESSION['post']);

Form2 would then get its data from $_SESSION['newpost']. After submit, Form2 would then once again have set $_SESSION['post'] from which I should be able to find the variables.

I'll test it in a bit.
ASK ME ANYTHING
I provide personalized help for Coffeecup Users including training for Site Designer and Web Form Builder via Zoom.
Email me at support@usconsumernet.org or call 865-687-7698.

Did you know that Web Form Builder can be used for both simple and complicated forms and that it's not limited to the default fonts and buttons? Take a look at a form we developed for WindowTinting.com.
https://forms.windowtinting.com/forms/w … ppingcart/
User 10077 Photo


Senior Advisor
1,095 posts

I figured it out today. Sometimes I use capital letters in my fieldnames. I think I'll stop. That was the issue. All the session keys are lowercase, regardless of what is put in WFB. As soon as I made the keynames all lowercase, everything worked.
ASK ME ANYTHING
I provide personalized help for Coffeecup Users including training for Site Designer and Web Form Builder via Zoom.
Email me at support@usconsumernet.org or call 865-687-7698.

Did you know that Web Form Builder can be used for both simple and complicated forms and that it's not limited to the default fonts and buttons? Take a look at a form we developed for WindowTinting.com.
https://forms.windowtinting.com/forms/w … ppingcart/
User 103173 Photo


VP of Software Development
0 posts

Those are word to live by Brian. Anything and everything I put online is always lowercase. That goes for images, html pages, scripts etc. If you get in the habit of mixing file case, these issues always tend to happen. If you always use lower case for everything, that eliminates a whole lot of troubleshooting. ;)
Learn the essentials with these quick tips for Responsive Site Designer, Responsive Email Designer, Foundation Framer, and the new Bootstrap Builder. You'll be making awesome, code-free responsive websites and newsletters like a boss.
User 187934 Photo


Senior Advisor
20,181 posts

Great you learned something today. It's kinda like .jpg and .JPG. I see a lot of that as devices seem to be random on what the write to a flash card.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2027917 Photo


Registered User
20 posts

Sorry to jump on an old post, but can anyone confirm WFB does indeed handle multiple page forms? I had thought that was not possible with WFB. Any chance there is some more detailed info about doing this?

Thanks!!!
User 187934 Photo


Senior Advisor
20,181 posts

Form builder doesn't do it directly. You need to setup the custom redirect to custom url and use those posted session variables.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2027917 Photo


Registered User
20 posts

Got it, thanks Eric. :)

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.