<?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: Dynamic Radio Button Value</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: Dynamic Radio Button Value</description>
<language>en</language>
<pubDate>Mon, 04 May 2026 00:21:19 +0000</pubDate>

<item>
<title>yuniar on "Dynamic Radio Button Value"</title>
<link>https://www.machform.com/forums/topic/dynamic-radio-button-value#post-11443</link>
<pubDate>Thu, 17 Feb 2011 16:41:04 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">11443@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Can you send me your file and the URL to your form please?&#60;br /&#62;
Send to: customer.service [at] appnitro.com&#60;/p&#62;
&#60;p&#62;I'll check it.
&#60;/p&#62;</description>
</item>
<item>
<title>msfbiz on "Dynamic Radio Button Value"</title>
<link>https://www.machform.com/forums/topic/dynamic-radio-button-value#post-11435</link>
<pubDate>Wed, 16 Feb 2011 19:16:21 +0000</pubDate>
<dc:creator>msfbiz</dc:creator>
<guid isPermaLink="false">11435@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I have tried the code, but it's not working.&#60;/p&#62;
&#60;p&#62;Also shouldn't it be &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if($option-&#38;gt;id == 2 &#38;#38;&#38;#38; $GLOBALS[&#38;#39;my_radio&#38;#39;] == 2){
	$option-&#38;gt;is_default = true;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;since we want the radio value 2 to be selected?&#60;/p&#62;
&#60;p&#62;In any case, I've tried with both == 1 and ==2 but couldn't get it to work.
&#60;/p&#62;</description>
</item>
<item>
<title>msfbiz on "Dynamic Radio Button Value"</title>
<link>https://www.machform.com/forums/topic/dynamic-radio-button-value#post-11433</link>
<pubDate>Wed, 16 Feb 2011 17:55:31 +0000</pubDate>
<dc:creator>msfbiz</dc:creator>
<guid isPermaLink="false">11433@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Great, thanks!!!
&#60;/p&#62;</description>
</item>
<item>
<title>yuniar on "Dynamic Radio Button Value"</title>
<link>https://www.machform.com/forums/topic/dynamic-radio-button-value#post-11423</link>
<pubDate>Tue, 15 Feb 2011 17:50:16 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">11423@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Ok, so let say you have a radio button like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;input id=&#38;quot;element_2_1&#38;quot; name=&#38;quot;element_2&#38;quot; class=&#38;quot;element radio&#38;quot; type=&#38;quot;radio&#38;quot; value=&#38;quot;1&#38;quot; /&#38;gt;
&#38;lt;label class=&#38;quot;choice&#38;quot; for=&#38;quot;element_2_1&#38;quot;&#38;gt;First option&#38;lt;/label&#38;gt;
&#38;lt;input id=&#38;quot;element_2_2&#38;quot; name=&#38;quot;element_2&#38;quot; class=&#38;quot;element radio&#38;quot; type=&#38;quot;radio&#38;quot; value=&#38;quot;2&#38;quot; /&#38;gt;
&#38;lt;label class=&#38;quot;choice&#38;quot; for=&#38;quot;element_2_2&#38;quot;&#38;gt;Second option&#38;lt;/label&#38;gt;
&#38;lt;input id=&#38;quot;element_2_3&#38;quot; name=&#38;quot;element_2&#38;quot; class=&#38;quot;element radio&#38;quot; type=&#38;quot;radio&#38;quot; value=&#38;quot;3&#38;quot; /&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;and your form code + variable is like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php

	$my_radio = 2;

	require(&#38;quot;/home/machform/machform.php&#38;quot;);
	$mf_param[&#38;#39;form_id&#38;#39;] = 159;
	$mf_param[&#38;#39;base_path&#38;#39;] = &#38;#39;http://example.com/machform/&#38;#39;;
	display_machform($mf_param);

?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;and our goal is to choose the second radio button (id = 2) when the value of $my_radio variable is 2 as well.&#60;/p&#62;
&#60;p&#62;So, all you need to do is to edit your &#34;includes/view-functions.php&#34; file.&#60;br /&#62;
Search around line 493 for this code:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;foreach ($element-&#38;gt;options as $option){&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;exactly below that code, add this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if($option-&#38;gt;id == 2 &#38;#38;&#38;#38; $GLOBALS[&#38;#39;my_radio&#38;#39;] == 1){
	$option-&#38;gt;is_default = true;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;that should do it.
&#60;/p&#62;</description>
</item>
<item>
<title>msfbiz on "Dynamic Radio Button Value"</title>
<link>https://www.machform.com/forums/topic/dynamic-radio-button-value#post-11416</link>
<pubDate>Mon, 14 Feb 2011 21:43:49 +0000</pubDate>
<dc:creator>msfbiz</dc:creator>
<guid isPermaLink="false">11416@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I'm using the advanced form code.&#60;/p&#62;
&#60;p&#62;No, the PHP variable is NOT passed as a URL parameter, it's defined in the PHP code of the page at the top.
&#60;/p&#62;</description>
</item>
<item>
<title>yuniar on "Dynamic Radio Button Value"</title>
<link>https://www.machform.com/forums/topic/dynamic-radio-button-value#post-11414</link>
<pubDate>Mon, 14 Feb 2011 16:33:08 +0000</pubDate>
<dc:creator>yuniar</dc:creator>
<guid isPermaLink="false">11414@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Are you using the advanced form code or the standard (iframe)?&#60;br /&#62;
Also, is the PHP variable being passed as URL parameter?
&#60;/p&#62;</description>
</item>
<item>
<title>msfbiz on "Dynamic Radio Button Value"</title>
<link>https://www.machform.com/forums/topic/dynamic-radio-button-value#post-11403</link>
<pubDate>Sat, 12 Feb 2011 01:26:15 +0000</pubDate>
<dc:creator>msfbiz</dc:creator>
<guid isPermaLink="false">11403@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I'd like to choose the value of a radio button according to the value of a PHP variable defined in the page where the Machform form is embedded.&#60;/p&#62;
&#60;p&#62;How do I need to modify view-functions.php file?&#60;/p&#62;
&#60;p&#62;Thanks!&#60;br /&#62;
Mike
&#60;/p&#62;</description>
</item>

</channel>
</rss>
