retrieve studentinformation in another page in codeigniter -
i have problem retrieving again in page of student information.
i can view students using through model , view:
public function viewdata() { $this->db->order_by("idnumber", "asc"); $query= $this->db->get('studentinformation'); return $query->result(); }
<table class=" table table-hover "> <thead> <tr> <th>id number</th> <th>firstname</th> <th>middlename</th> <th>lastname</th> <th>sex</th> </tr> </thead> <?php foreach($this->model_adminlogin->viewdata() $row){ ?> <tbody> <tr> <td><?php echo $row->idnumber?></td> <td><?php echo $row->firstname?></td> <td><?php echo $row->middlename?></td> <td><?php echo $row->lastname?></td> <td><?php echo $row->sex ?></td> <td> <a href="<?php echo site_url('viewstudentinalpha/viewspecific/'.$row->id) ?>" class="btn btn-info" type="submit" name="submit" role="button">option</a> </td> </tr> </tbody> <?php } ?> </table>
also can view them every student information using in model , controller , view:
function getonerow($id) { $this->db->where('id',$id); $query=$this->db->get('studentinformation'); return $query->row(); }
public function viewspecific($id) { if($this->session->userdata('logged_in')) { $this->output->set_header('expires: sat, 26 jul 1997 05:00:00 gmt'); $this->output->set_header('cache-control: no-cache, no-store, must-revalidate, max-age=0'); $this->output->set_header('cache-control: post-check=0, pre-check=0', false); $this->output->set_header('pragma: no-cache'); $session_data = $this->session->userdata('logged_in'); $data['username'] = $session_data['username']; $row=$this->model_adminlogin->getonerow($id); $data['r']=$row; $this->load->view('individualviewstudent',$data); } else{ redirect('welcome', 'refresh'); } if((!isset($session_data) || $session_data !=true)) { redirect('welcome', 'refresh'); } }
and view using $r
<label class="z label-primary">name:</label> <span class="z"> <?php echo $r -> firstname." ". $r-> middlename." ".$r-> lastname; ?></span><br> </div> <div class="spacesz"> <label class="z label-primary">id number: </label><span class="z"> <?php echo $r->idnumber; ?></span> </div> <div class="spacesz"> <label class="z label-primary">age:</label><span class="z"> <?php echo $r-> age; ?></span> </div> etc.......................................................................................
my problem how can retrieve again view page student click updating purpose?? image of problem -> retrieve in page of student
use id available in object $r
.
<?php echo site_url('student/update/'.$r->id) ?>
place above code in update student link. below:
<a href="<?php echo site_url('student/update/'.$r->id) ?>">update student</a>
Comments
Post a Comment