Yet Another Checkbox checking in the form thread, check it out and help me :( |
[eluser]Kinsbane[/eluser]
Followed the code in this thread: http://ellislab.com/forums/viewthread/73012/P0/ to adjust the validation class. But, I'm having no luck. Short of it: Users can check one or more checkboxes in different groups ($products[], $documents[], etc) to receieve email updates. When the page is loaded, though, the data gets properly retrieved from the database, but no checkboxes are checked. Here's what I've got: Code: if ($query->num_rows > 0) { // if the current user is in the database Now, I'm templating my views out and so the form with all the checkboxes is in its own file, called like so: Code: $this->load->view('general/start_page', $data); Finally, my form with the checkboxes looks like this: Code: <?= form_open('notifications/update'); ?> However, I have checked the update mechanism and the data gets processed and inserted correctly. The only issue is actually setting the checkboxes in the form itself, which I can't see why it's not.
[eluser]Sumon[/eluser]
Try to use Code: <input type="checkbox" name="products[]" value="1" <?php echo set_checkbox('products[]', '1'); ?> />
[eluser]Kinsbane[/eluser]
That returns an error: Call to undefined function: set_checkbox() ![]() Thing is, I had this working a couple weeks ago. But since I moved to an auth library from the CI wiki, something's changed to make this not work and I can't remember what it was... and there happens to be no backups, to make things worse ![]()
[eluser]Sumon[/eluser]
what about? Code: <input type="checkbox" name="products[]" value="1" <?php echo $this->validation->set_checkbox('products[]', '1'); ?> />
[eluser]Kinsbane[/eluser]
Here we go! I had found this thread back in April and this is what I had used when it worked. Just re-did it (after upgrading to 1.6.3) and now it works as it should! |
Welcome Guest, Not a member yet? Register Sign In |