Welcome Guest, Not a member yet? Register   Sign In
Repopulate checkboxes
#1

[eluser]kamikaz[/eluser]
Hi,

I have a problem to repopulate checkboxes.

I have thing like that:
Code:
<input type="checkbox" name="roles[]" value="1" id="admin"  />
<input type="checkbox" name="roles[]" value="2" id="president" />
...

How to get value for each inputs ? I mean if the second one is checked, the array begin at 0 when I want to check which one is checked.

I tried to use the "set_checkbox()" like shown in the user guide but it did nothing:
Code:
<input type="checkbox" name="roles[]" value="1" id="admin"
                    <?= set_checkbox( 'roles ( [] )', '1' ); ?>  />

( [] ) because I tried both Smile

Didn't find on the internet what I was looking for Smile

Thank you for your help
#2

[eluser]InsiteFX[/eluser]
Just a note here you need to have a form set_rules for the checkbox.

Code:
<input type="checkbox" name="roles[]" value="1" id="admin"  <?php echo set_checkbox( 'roles []', '1' ); ?>  />
#3

[eluser]Unknown[/eluser]
[quote author="InsiteFX" date="1378239712"]Just a note here you need to have a form set_rules for the checkbox.

Code:
<input type="checkbox" name="roles[]" value="1" id="admin"  <?php echo set_checkbox( 'roles []', '1' ); ?>  />
[/quote]

Yes, you sloved the problem

nâng ngực nội soi
#4

[eluser]kamikaz[/eluser]
Thank you InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB