<?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 Variable as Default Value in Admin Only Fields?</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: Session Variable as Default Value in Admin Only Fields?</description>
<language>en</language>
<pubDate>Wed, 06 May 2026 06:33:53 +0000</pubDate>

<item>
<title>walags on "Session Variable as Default Value in Admin Only Fields?"</title>
<link>https://www.machform.com/forums/topic/session-variable-as-default-value-in-admin-only-fields#post-2332</link>
<pubDate>Sun, 13 Jul 2008 07:46:41 +0000</pubDate>
<dc:creator>walags</dc:creator>
<guid isPermaLink="false">2332@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Man I can't tell you how great this is working. I have two fields (username\email) which are hidden on my form and automatically filled in with session variables. User just fills out form and it automatically emails to them while I get to see who submitted it. I knew this is how I wanted to implement it, but didn't think it would be this easy.
&#60;/p&#62;</description>
</item>
<item>
<title>yuniar on "Session Variable as Default Value in Admin Only Fields?"</title>
<link>https://www.machform.com/forums/topic/session-variable-as-default-value-in-admin-only-fields#post-2297</link>
<pubDate>Wed, 09 Jul 2008 12:59:37 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">2297@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Have you tried adding the code I posted above? and your if statement didn't processed?
&#60;/p&#62;</description>
</item>
<item>
<title>walags on "Session Variable as Default Value in Admin Only Fields?"</title>
<link>https://www.machform.com/forums/topic/session-variable-as-default-value-in-admin-only-fields#post-2280</link>
<pubDate>Tue, 08 Jul 2008 11:22:50 +0000</pubDate>
<dc:creator>walags</dc:creator>
<guid isPermaLink="false">2280@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Well that was easy hiding the field. &#60;/p&#62;
&#60;p&#62;As for using iframe instead of php code... I'm not sure how each of those interact with the view-functions but using the php code the custom if statement never gets entered
&#60;/p&#62;</description>
</item>
<item>
<title>yuniar on "Session Variable as Default Value in Admin Only Fields?"</title>
<link>https://www.machform.com/forums/topic/session-variable-as-default-value-in-admin-only-fields#post-2276</link>
<pubDate>Mon, 07 Jul 2008 18:51:45 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">2276@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Sorry, after re-reading my post on that thread. I think I got something wrong.&#60;br /&#62;
It won't work for admin field, since admin field can only be seen by admin only.&#60;/p&#62;
&#60;p&#62;Are you trying to do a hidden field and pass your session variable there?&#60;/p&#62;
&#60;p&#62;If so, I suggest to just use a normal field, not admin field, and then set the CSS of that field to hidden.&#60;/p&#62;
&#60;p&#62;This way, your users won't see the field, but you still get the value.&#60;br /&#62;
Is this what you need?&#60;/p&#62;
&#60;p&#62;---&#60;/p&#62;
&#60;p&#62;Regarding your usage of iframe instead of the php code.&#60;br /&#62;
Try to use the PHP code again, but at the very beginning of you PHP file, add this line:&#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>walags on "Session Variable as Default Value in Admin Only Fields?"</title>
<link>https://www.machform.com/forums/topic/session-variable-as-default-value-in-admin-only-fields#post-2269</link>
<pubDate>Mon, 07 Jul 2008 12:44:41 +0000</pubDate>
<dc:creator>walags</dc:creator>
<guid isPermaLink="false">2269@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Well I took of all but one of those problems by inserting the form via the standard iframe rather than php. When I have a regular public field everything works like a champ.&#60;/p&#62;
&#60;p&#62;However once I make that an admin field it does not record that data.&#60;/p&#62;
&#60;p&#62;Advice?
&#60;/p&#62;</description>
</item>
<item>
<title>walags on "Session Variable as Default Value in Admin Only Fields?"</title>
<link>https://www.machform.com/forums/topic/session-variable-as-default-value-in-admin-only-fields#post-2268</link>
<pubDate>Mon, 07 Jul 2008 12:31:29 +0000</pubDate>
<dc:creator>walags</dc:creator>
<guid isPermaLink="false">2268@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I am posting to get more information from a previous thread. &#60;a href=&#34;http://www.appnitro.com/forums/topic/enable-code-in-admin-only-fields?replies=10&#34; rel=&#34;nofollow&#34;&#62;http://www.appnitro.com/forums/topic/enable-code-in-admin-only-fields?replies=10&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;To automatically assign a value of a text field to that of a system variable you said to add the following code...&#60;/p&#62;
&#60;p&#62;//check for populated value, if exist, use it instead default_value&#60;br /&#62;
if(!empty($element-&#38;gt;populated_value['element_'.$element-&#38;gt;id]['default_value'])){&#60;br /&#62;
	$element-&#38;gt;default_value = $element-&#38;gt;populated_value['element_'.$element-&#38;gt;id]['default_value'];&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;Right under that block of code, add this code:&#60;/p&#62;
&#60;p&#62;if(($_REQUEST['id'] == 12) &#38;#38;&#38;#38; ($element-&#38;gt;id == 3)){&#60;br /&#62;
	$element-&#38;gt;default_value = $_SESSION['your_session_var'];&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;* My if statement is not being entered. I have changed the request id to that of my form and I can't get through it. I put an echo statement before and inside and can verify that.&#60;br /&#62;
* My form will only have 1 test field anyway so I am ok with just setting the default value to always be my session variable.&#60;br /&#62;
* When the field is public the variable gets passed with no problems and enters the database.&#60;br /&#62;
* When the field is private the value does not get saved in the database.&#60;/p&#62;
&#60;p&#62;Is there any other fixes or ways about passing a sessions variable as the default value in an admin text field?
&#60;/p&#62;</description>
</item>

</channel>
</rss>
