Welcome Guest, Not a member yet? Register   Sign In
Edit my application previously selected item should be viewed?
#1

(This post was last modified: 09-09-2018, 11:51 PM by kvanaraj.)

I want to my application previously selected items to be displayed accordingly.
How to implement this .
Controller
********
Code:
$data['getcert'] = $this->User_Model->getcert();
Model
*****
Code:
$regno = $this->session->userdata('username');
  $this->db->select('*');
  $this->db->from('certificate_det');
  $this->db->where('appdet.regno',$regno);
  $this->db->join('appdet', 'appdet.certid = certificate_det.certificate_id', 'left');
  $query = $this->db->get();
  return $query->result_array();
  echo $query;  
    }

View
*****
Code:
value="<?php echo (!isset($posted['email'])) ? '' : $posted['email'] ?>"
Is this way to fetch the details

Attached Files Thumbnail(s)
   
Reply
#2

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 )
Reply
#3

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
Reply
#4

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.
Reply
#5

(09-10-2018, 07:33 AM)Wouter60 Wrote: 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.

Code:
<?php foreach($getcert as $student){

Code:
<input type="checkbox" id="mycheck1" name="certid[]" 
       value="<?php echo set_checkbox($student['certid']) ? '1' : $student['certid'] ?>"
        class="cbx">

Code:
output
*********
Array
(
   [id] => 1
   [certificate_id] => 1
   [fee] => 500
   [APPNO] => 10001
   [regno] => 01107402042
   [certid] => 1
   [noc] => 2
   [paid] => 5000
)
Reply
#6

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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB