[eluser]originalmmd[/eluser]
Hi all
I'm getting the following error when submitting the form in my application. New to CI and pretty much php, so I have no clue what's wrong.
My View
Code:
<?php
// load header template
$this->load->view('inc/html/header');
$this->load->helper('form');
$this->load->helper('date');
?>
<?php
// start page content
foreach($result as $row):?>
<div data-role="collapsible-set">
<div data-role="collapsible" data-collapsed="true" data-theme="b">
<h3><?=$row->id?> <?=$row->name?></h3>
<!--codeigniter OPEN form-->
<?php $attributes = array('class' => 'login', 'id' => 'login');
echo form_open('employeeselect', $attributes); ?>
<!--codeigniter open form-->
<!--codeigniter buttons-->
<?php
foreach($person as $persons):
form_hidden('projectid', $row->id);
form_hidden('userid', $persons->id);
form_hidden('date', now());
$attributes = array('name' => 'mysubmit', 'data-role' => 'button', 'data-inline' => 'true','data-theme' => 'e');
echo form_submit($attributes , $persons->firstname.' '.$persons->lastname);
endforeach;
?>
<!--codeigniter buttons-->
<!--codeigniter CLOSE form-->
<?php echo form_close(); ?>
<!--codeigniter CLOSE form-->
</div>
</div>
<?php endforeach;
// end page content
?>
<?php
// load footer template
include 'inc/html/footer.php'
?>
Controller:
Code:
<?php
class employeeselect extends CI_Controller{
function index()
{
$this->load->model('employeeselect_model');
$this->load->database();
$data['result'] = $this->employeeselect_model->get_project();
$data['person'] = $this->employeeselect_model->get_person();
$data['page_title'] = "CI Hello World App!";
$this->load->view('employeeselect_view',$data);
}
function punch()
{
//use the model to submit the posted data
$this->load->database();
$this->employeeselect_model->punch_in();
redirect('employeeselect');
}
}
?>
Model
Code:
<?php
class employeeselect_model extends CI_Model {
function __construct()
{
// Call the Model constructor
parent::__construct();
$this->load->database();
}
function get_project()
{
$query = $this->db->get('project', 10);
return $query->result();
}
function get_person()
{
$query = $this->db->get('person');
return $query->result();
}
function punch_in()
{
$this->load->database();
$this->userid = $this->input->post('userid');
$this->projectid = $this->input->post('projectid');
$this->time = now();
//$this->db->insert('punch',$this);
}
}
?>
Any help would be appreciated