<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>MachForm Community Forums Topic: $_SESSION['form_data'] variables not working immediately</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: $_SESSION['form_data'] variables not working immediately</description>
<language>en</language>
<pubDate>Sun, 03 May 2026 23:07:49 +0000</pubDate>

<item>
<title>yuniar on "$_SESSION['form_data'] variables not working immediately"</title>
<link>https://www.machform.com/forums/topic/_sessionform_data-variables-not-working-immediately#post-9707</link>
<pubDate>Wed, 16 Jun 2010 18:55:46 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">9707@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Thanks for sharing the solution Mike. &#60;/p&#62;
&#60;p&#62;session_start() is indeed needed for all pages which uses session variables.
&#60;/p&#62;</description>
</item>
<item>
<title>msfbiz on "$_SESSION['form_data'] variables not working immediately"</title>
<link>https://www.machform.com/forums/topic/_sessionform_data-variables-not-working-immediately#post-9697</link>
<pubDate>Tue, 15 Jun 2010 17:08:00 +0000</pubDate>
<dc:creator>msfbiz</dc:creator>
<guid isPermaLink="false">9697@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Ok, I just solved it.&#60;/p&#62;
&#60;p&#62;What was missing was the &#60;/p&#62;
&#60;p&#62;	session_start();&#60;/p&#62;
&#60;p&#62;On the form page as well. I had it on the success page only.&#60;/p&#62;
&#60;p&#62;So to summarize, if you need to retrieve data on your success page through session variables, you need to put the&#60;/p&#62;
&#60;p&#62;session_start();&#60;/p&#62;
&#60;p&#62;PHP statement on BOTH your form and success page.&#60;/p&#62;
&#60;p&#62;Mike
&#60;/p&#62;</description>
</item>
<item>
<title>msfbiz on "$_SESSION['form_data'] variables not working immediately"</title>
<link>https://www.machform.com/forums/topic/_sessionform_data-variables-not-working-immediately#post-9696</link>
<pubDate>Tue, 15 Jun 2010 14:58:33 +0000</pubDate>
<dc:creator>msfbiz</dc:creator>
<guid isPermaLink="false">9696@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I have a form that leads to a success page that uses $_SESSION['form_data'] variables to populate the success page.&#60;/p&#62;
&#60;p&#62;E.g.&#60;br /&#62;
&#38;lt;?php&#60;br /&#62;
session_start();&#60;br /&#62;
$name = $_SESSION['form_data']['element_1_2'];&#60;br /&#62;
echo &#34;Welcome &#34; . $name;&#60;br /&#62;
?&#38;gt;&#60;/p&#62;
&#60;p&#62;But it doesn't work form the start. The success page doesn't show any of the $_SESSION['form_data'] variables.&#60;/p&#62;
&#60;p&#62;However, if I hit the back button and resubmit the form data then the success page is populated correctly.&#60;/p&#62;
&#60;p&#62;Please help resolve this issue.&#60;/p&#62;
&#60;p&#62;Here's the code I have for the php-functions.php file:&#60;/p&#62;
&#60;p&#62;		//if there is any error message or elements, send false as status&#60;br /&#62;
		if(empty($error_elements) &#38;#38;&#38;#38; empty($process_result['custom_error'])){&#60;br /&#62;
			$process_result['status'] = true;&#60;br /&#62;
			//Store form variables in session variables&#60;br /&#62;
			$_SESSION['is_valid_user'] = true;&#60;br /&#62;
			$_SESSION['form_data'] = $table_data;&#60;br /&#62;
			$_SESSION['form_data']['id'] = $record_insert_id;&#60;/p&#62;
&#60;p&#62;			//if 'form review' enabled, send review_id&#60;br /&#62;
			if(!empty($form_review)){&#60;br /&#62;
				$process_result['review_id']   = $record_insert_id;&#60;br /&#62;
			}&#60;br /&#62;
		}else{&#60;br /&#62;
			$process_result['status'] = false;&#60;br /&#62;
		}&#60;/p&#62;
&#60;p&#62;		return $process_result;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;I can privately email my form and success pages with code and links if needed.&#60;/p&#62;
&#60;p&#62;Thanks!&#60;br /&#62;
Mike
&#60;/p&#62;</description>
</item>

</channel>
</rss>
