Working with arrays and checkboxes - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Working with arrays and checkboxes (/showthread.php?tid=54647) |
Working with arrays and checkboxes - El Forum - 09-18-2012 [eluser]xtremer360[/eluser] If you notice in the bottom var dump you notice how both of the objects have a news article id of 1 which is the article your viewing which is right. Now the tags associated with it is tag id 1 and tag id of 2. So if you look above those are all the post tags in the database. I need it to take those two post tag ids of 1 and 2 and scroll through the top object and have the post tag with an id of 1 and 2 be checked so according to this the checkbox of Kid Wonder and Oriel should both be checked. I tried the in_array but couldn't find a working solution. Code: news_article_post_tags Code: <?php Working with arrays and checkboxes - El Forum - 09-18-2012 [eluser]CroNiX[/eluser] Look at how you are creating form_checkbox() and then compare it to the user guide. You're setting your checkboxes wrong. From the user guide for form_checkbox(): Code: $data = array( Working with arrays and checkboxes - El Forum - 09-18-2012 [eluser]CroNiX[/eluser] Also, your form_label() appears to be wrong. (look at where you are concatenating using a . where a , should be used to separate the first and 2nd parameters) Working with arrays and checkboxes - El Forum - 09-18-2012 [eluser]xtremer360[/eluser] Now it won't even even the label. Plus this doesn't even help in my original issue. Code: <?php Working with arrays and checkboxes - El Forum - 09-18-2012 [eluser]CroNiX[/eluser] Sorry, just pointing out mistakes as I see them. I'll leave you to it now... Working with arrays and checkboxes - El Forum - 09-18-2012 [eluser]xtremer360[/eluser] That's why I came here. I do thank you for pointing out the mistake but since I fixed an issue like you suggested it did create another issue with not echoing the label. |