Welcome Guest, Not a member yet? Register   Sign In
avoid resend data when click on refresh menu
#1

[eluser]ranjitbd[/eluser]
Code:
//how to avoid sending data into database when click on refresh button.
//i already set validation.so no one can submit any empty feedback.but when a feed back //is submitted and show the session message to the
//user that feedback submitted successfully.then if i click on refresh in the browser it //submitted again.
//i can redirect to another page to avoid this.but i want to stay in the same feed back //page..

//here is my code

  function feedback()
  {  
      $data = array();
      $data[‘mainContent’] = $this->load->view(‘tmbd/feedback’, $data, true);
      $this->load->view(‘index’, $data);
  }

  function feedbackSave()
  {
      $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();
  }
// i cant go to another page.i have to show that feedback page to user even after submit feed back just with a flash message.
//maybe it can be solved by using headers function to reload the page….but i dnt knw how to use it?
#2

[eluser]pistolPete[/eluser]
You already posted here the same question: http://ellislab.com/forums/viewthread/127492/

And it was already answered, you have to do a redirect do clean the POST data.




Theme © iAndrew 2016 - Forum software by © MyBB