Hear is my code that i used.
$data = array( question=>$this->input->post('questions'),
answer1=>$this->input->post('answer1'),
answer2=>$this->input->post('answer2'),
answer3=>$this->input->post('answer3'),
answer4=>$this->input->post('answer4'),
answer5=>$this->input->post('answer5'),
correctanswer=>$this->input->post('correctanswer')
);
$this->db->insert('questionandanswers',$data);
Please provide help for this notice message.
A PHP Error was encountered
Severity: Notice
Message: Use of undefined constant question - assumed 'question'
You need to add single quote on array key because it consider array key question
as constant.
Your array should be like..
$data = array(
'question'=>$this->input->post('questions'),
'answer1'=>$this->input->post('answer1'),
'answer2'=>$this->input->post('answer2'),
'answer3'=>$this->input->post('answer3'),
'answer4'=>$this->input->post('answer4'),
'answer5'=>$this->input->post('answer5'),
'correctanswer'=>$this->input->post('correctanswer')
);
$this->db->insert('questionandanswers',$data);