Edit my application previously selected item should be viewed? |
I want to my application previously selected items to be displayed accordingly.
How to implement this . Controller ******** Code: $data['getcert'] = $this->User_Model->getcert(); ***** Code: $regno = $this->session->userdata('username'); View ***** Code: value="<?php echo (!isset($posted['email'])) ? '' : $posted['email'] ?>"
Maybe set_value from the form helper.
You need to start looking this simple stuff up yourself instead of relying on the forum users. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
I would store the selected values linked to the user's session data, that way you can access their selected choices on any page. Although I'm not entirely sure what you are doing.
Practical guide to IgnitedCMS - Book coming soon, www.ignitedcms.com
With so little code, it's hard to tell what you actually mean.
I guess you want to repopulate the form with previously made choices if the form isn't filled in completely, right? Use the form_validation library. It is well documented on the CI website. There's a function called set_checkbox() in the form helper too. (09-10-2018, 07:33 AM)Wouter60 Wrote: With so little code, it's hard to tell what you actually mean. Code: <?php foreach($getcert as $student){ Code: <input type="checkbox" id="mycheck1" name="certid[]" Code: output
Don't use set_checkbox() to change the value of the checkbox, just it's checked or unchecked status!
You really should start reading the documentation!! And once again: it won't work of you give elements the id="mycheck1" in a control structure like foreach { }. If there are 10 checkboxes, they all have the same id. How would that help you to find the right one? So, forget the whole id part. Use a css class to handle the checkboxes through jQuery, and an array name like "certid[]" to return the values of the checked checkboxes to your controller after submitting the form. If you're going to use form_validation, use the "certid[]" reference too, including the square brackets. There are lots of examples for that on the internet. |
Welcome Guest, Not a member yet? Register Sign In |