[eluser]budbud[/eluser]
Usually I use if clause to handle this problem.
I catch name of the submit button from view to the if clause.
If the button clicked, the code successfully execute, else do nothing.
Example :
Code:
<?php
function feedbackSave()
{
if($this->input->post('submit'))//button name depending what you set it
{
$data=array();
$data[‘subject’] = $this->input->post(‘subject’, true);
$data[‘name’] = $this->input->post(‘lname’, true);
$data[‘address’] = $this->input->post(‘address’, true);
$data[‘email’] = $this->input->post(‘email’, true);
$data[‘mobile’] = $this->input->post(‘mobile’, true);
$data[‘comments’] = $this->input->post(‘comments’, true);
$datetime = date(‘Y-m-d H:i:s’);
$data[‘date’] = $dateTime;
$this->load->model($this->config->item(‘generalModel’), ‘save_feedback’,TRUE);
$this->save_feedback->feedbackSave($data);
$this->session->set_flashdata(‘feedback’, ‘Feedback send successfully’);
$this->feedback();
}
}
?>
Hope I can help you,.