Welcome Guest, Not a member yet? Register   Sign In
Problems coding for form_radio()
#6

[eluser]bhogg[/eluser]
set_radio() isn't really designed for use with form_radio but rather with a manual <input type="radio" ... /> tag. The hack of a workaround is something like (replacing users/dashboard with your form):

Code:
<div>

&lt;?php echo form_open("users/dashboard"); ?&gt;
&lt;?php echo form_radio("testing", "val1", trim(set_radio("testing", "val1")) == 'checked="checked"' ? true : false ); ?&gt; VAL1<br />
&lt;?php echo form_radio("testing", "val2", trim(set_radio("testing", "val2")) == 'checked="checked"' ? true : false ); ?&gt; VAL2<br />

&lt;?php echo form_submit("submit", "submit"); ?&gt;

<pre>
&lt;?php var_dump(set_radio("testing", "val1")); ?&gt;
&lt;?php var_dump(set_radio("testing", "val2")); ?&gt;
</pre>

&lt;?php echo form_close(); ?&gt;

</div>

I just put $this->load->library('form_validation'); in the controller to get this working.


Messages In This Thread
Problems coding for form_radio() - by El Forum - 04-20-2010, 04:21 AM
Problems coding for form_radio() - by El Forum - 04-20-2010, 05:00 AM
Problems coding for form_radio() - by El Forum - 04-20-2010, 05:54 AM
Problems coding for form_radio() - by El Forum - 04-20-2010, 05:55 AM
Problems coding for form_radio() - by El Forum - 04-20-2010, 12:53 PM
Problems coding for form_radio() - by El Forum - 04-21-2010, 12:27 PM
Problems coding for form_radio() - by El Forum - 04-21-2010, 02:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB