<?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: Not setting Session cookie when embedded with PHP</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: Not setting Session cookie when embedded with PHP</description>
<language>en</language>
<pubDate>Sun, 03 May 2026 20:41:02 +0000</pubDate>

<item>
<title>slcmarcomm on "Not setting Session cookie when embedded with PHP"</title>
<link>https://www.machform.com/forums/topic/not-setting-session-cookie-when-embedded-with-php#post-23316</link>
<pubDate>Thu, 21 May 2015 02:01:45 +0000</pubDate>
<dc:creator>slcmarcomm</dc:creator>
<guid isPermaLink="false">23316@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I discovered it's happening because &#60;code&#62;session_start()&#60;/code&#62; will only send cookies if there's nothing output before it on the page (and headers need to be sent before content). But since the form is included on a page that has already printed a lot of HTML, the cookies were unable to be set, and so the &#60;code&#62;$_SESSION[&#38;#39;mf_form_completed&#38;#39;]&#60;/code&#62; remained empty.&#60;/p&#62;
&#60;p&#62;To fix this, I edited the view-functions.php to add a &#60;code&#62;&#38;lt;script&#38;gt;Cookies.set(&#38;quot;PHPSESSID&#38;quot;,&#38;quot;{$session_id}&#38;quot;,{ expires: 1, path: &#38;quot;/&#38;quot; });&#38;lt;/script&#38;gt;&#60;/code&#62; to the page and had previously included the Cookies plugin: &#60;a href=&#34;https://github.com/js-cookie/js-cookie&#34; rel=&#34;nofollow&#34;&#62;https://github.com/js-cookie/js-cookie&#60;/a&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>Steve1951 on "Not setting Session cookie when embedded with PHP"</title>
<link>https://www.machform.com/forums/topic/not-setting-session-cookie-when-embedded-with-php#post-23315</link>
<pubDate>Thu, 21 May 2015 00:07:49 +0000</pubDate>
<dc:creator>Steve1951</dc:creator>
<guid isPermaLink="false">23315@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Make sure the first line of your PHP script contains&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#38;lt;?php session_start(); ?&#38;gt;&#60;/code&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>slcmarcomm on "Not setting Session cookie when embedded with PHP"</title>
<link>https://www.machform.com/forums/topic/not-setting-session-cookie-when-embedded-with-php#post-23313</link>
<pubDate>Wed, 20 May 2015 20:46:20 +0000</pubDate>
<dc:creator>slcmarcomm</dc:creator>
<guid isPermaLink="false">23313@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I've embedded my form using the PHP embedder, which is what I want to do so that people without JS can use the form.&#60;/p&#62;
&#60;p&#62;However, it seems that it's not setting the Session cookie at all. This means that when I submit the form, it still shows me the form, instead of showing me the &#34;Thank you&#34; text, even though the URL has &#34;done=1&#34;.&#60;/p&#62;
&#60;p&#62;Is there something I need to configure on the server for this? Or something else that needs to be done? Here's the PHP info: &#60;a href=&#34;https://www.dropbox.com/s/gly0nyhlsi99zkx/Screenshot%202015-05-20%2009.46.05.png?dl=0&#34; rel=&#34;nofollow&#34;&#62;https://www.dropbox.com/s/gly0nyhlsi99zkx/Screenshot%202015-05-20%2009.46.05.png?dl=0&#60;/a&#62;
&#60;/p&#62;</description>
</item>

</channel>
</rss>
