Welcome Guest, Not a member yet? Register   Sign In
repopulate array checkbox
#1

[eluser]Schumacher[/eluser]
So, im mkaing this site where i need to have some informations on the user, so i have a a few checkboxes that can be checked, but the problem is that i can't find a way to repopulate the checked boxes after the form_validation has failed.

i tried in every way the user guide told me, but it just dosn't work .
i have :

$data = array( 'name' => 'seek[]',
'value' => $key,
);
echo "<span class='checkbox'>".form_checkbox($data['name'], $data['value'], '', set_checkbox($data['name'], $data['value']))." ".$value."</span>";

but this just dosn't work.
before i had

form_checkbox($data);

but i tried the other thing to see if it worked then.
i think the problem is that the set_checkbox() returns checked = checked, but the from_checkbox() only wants true or false.

hope you can help Smile
#2

[eluser]Schumacher[/eluser]
Ahh, found the problem. After i seached the forum a little more i found out that i still needed the have rules set on the array checkbox before it could repopulate.




Theme © iAndrew 2016 - Forum software by © MyBB