Welcome Guest, Not a member yet? Register   Sign In
avoid sending data when refreshed page
#4

[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,.


Messages In This Thread
avoid sending data when refreshed page - by El Forum - 08-27-2009, 02:48 AM
avoid sending data when refreshed page - by El Forum - 08-27-2009, 07:17 AM
avoid sending data when refreshed page - by El Forum - 09-01-2009, 03:01 AM
avoid sending data when refreshed page - by El Forum - 09-01-2009, 05:04 AM
avoid sending data when refreshed page - by El Forum - 09-02-2009, 10:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB