Welcome Guest, Not a member yet? Register   Sign In
radio button validation

I'm stabbing in the dark here.
How am i supposed to set up a working validation for a few radiobuttons.

Let's say i have this in my view:
<input type="radio" name="voor" value"1"> Part one
<input type="radio" name="voor" value"2"> Part two

then i would have this in my controller:
if ($this->form_validation->run() == FALSE)
echo 'hoorai';

The main problem i'm experiencing is that the value of the post variable is "ON" when something is selected. and false when nothing has been. I can imagine set_radio having trouble finding which radio button it should select after submitting/failing validation.

for some reason i wasn't getting the right response from the validation class.
I got it to work but i'm still wondering what my mistake was.
Form validation has this knack of bugging me every time i use it Smile

this is working:
<input type="radio" name="voor" value="1" <?=set_radio('voor','1',true)?> />

still registering the radio buttons:

So if anyone would care to enlighten me what i did wrong or could've done wrong in the first place.

Thanks a bunch and sorry for my semi-irrelevant question

Theme © iAndrew 2016 - Forum software by © MyBB