⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Add Extra input fields per student for Grading and have save button



xmyownprisonx
  • profile picture
  • Member

Posted 26 August 2016 - 13:22 PM

[attachment=1137:SS-For-Grading.jpg]

 

I have a controller, view and model shown below. and the attached image is the output.

 

Is there a possible way or a workaround that I can add input fields on every list of students and have save button per student or batch save?

 

OR

 

Any suggestions for Grading Input is really much appreciated. Thanks and more power.

 

 

 

//Controller

<?php
class Home extends CI_Controller {

 function Home(){
  parent::__construct();

  $this->load->model('HomeModel');

 }

 public function index(){

     if (!$this->ion_auth->in_group('faculty'))
     {
            $this->session->set_flashdata('message', 'You must be an admin to view this page!!');
            redirect('encoding/encoding_app');
        }

  $query = $this->HomeModel->getStudents();
  $data['STUDENTS'] = null;
  if($query){
   $data['STUDENTS'] =  $query;
  }
  $this->load->view('includes/header');
  $this->load->view('index.php', $data);
  $this->load->view('includes/footer');
 }
}
?>

 

//view

<!DOCTYPE html>
<html lang="en">
 <head>
  <title>Student List</title>
  <!--<link href="<?= base_url();?>css/bootstrap.css" rel="stylesheet">-->
  <link href="<?=base_url('assets/css/customize-template.css');?>" type="text/css" media="screen, projection" rel="stylesheet" />
 </head>
 <body>
  <div class="row">
   <div style="width:500px;margin:50px;">
    <h4>List of Students</h4>
    <table class="table table-striped table-bordered">
     <tr><td><strong>STATUS</strong></td>
         <td><strong>Student Id</strong></td>
         <td><strong>LAST Name</strong></td>
         <td><strong>FIRST Name</strong></td>
         <td><strong>MIDDLE NAME</strong></td>
         <td><strong>BATCH</strong></td>
         <td><strong>GRADE</strong></td>
         <td><strong>TERM</strong></td>
         <td><strong>SECTION</strong></td>
         <td><strong>SUBJECT</strong></td>
         <td><strong>FACULTY</strong></td></tr>
     <?php foreach($STUDENTS as $student){?>
     <tr><td><?=$student->status_desc;?></td>
        <td><?=$student->student_no;?></td>
         <td><?=$student->last_name;?></td>
         <td><?=$student->first_name;?></td>
         <td><?=$student->middle_name;?></td>
         <td><?=$student->batch_desc;?></td>
         <td><?=$student->grade;?></td>
         <td><?=$student->term;?></td>
         <td><?=$student->section_desc;?></td>
         <td><?=$student->subject;?></td>
         <td><?=$student->faculty;?></td>
         <td><input type="text" name="first_qtr" value="" /></td></tr>     
        <?php }?>  
    </table>
   </div>
  </div>
 </body>
</html>

 

// Model

 

<?php
class HomeModel extends CI_Model {

 function HomeModel(){
  parent::__construct();
 }

 function getStudents(){
                  
         
  $this->db->select("status_desc,student_no,last_name,first_name,middle_name,batch_desc,grade,term,section_desc,subject,faculty");
  $this->db->from('vwencoding');
 
  $query = $this->db->get();
  return $query->result();
 }
}
?>