Welcome Guest, Not a member yet? Register   Sign In
When I refresh a page it sends the same data
#1

[eluser]shinokada[/eluser]
I have a following controller, model and view.

When I refresh a page it sends the same data again.

What am I doing wrong here?

Thanks in advance.

Code:
//Controller

   function Welcome()
    {
        parent::Controller();
                $this->load->helper('url');
                $this->load->database();
    }

   function forms(){
            $data['header']='input form';
            $data['title']='input form';
            $this->load->model('MForm');
            if ($this->input->post('start_time')){
               $this->MForm->enterform();
                redirect('welcome/forms', 'refresh');
             }else{
                $this->load->view('forms',$data);
            }            
        }

// model

function enterform(){

        $data = array(
            'date' => $this->input->post('date'),
            'start_time' => $this->input->post('start_time'),
            'finish_time' => $this->input->post('finish_time'),
            'instructor' => $this->input->post('instructor'),
        );
        $this->db->insert('schedules',$data);
     }


// view

<form name="form1" method="post" action="forms">
    <!-- form 1 -->
<label for='start_time'>1. Start Time</label>
&lt;input type="text" name="start_time" /&gt;
<label for='finish_time'>Finish Time</label>
&lt;input type="text" name="finish_time" /&gt;
<label for='instructor'>Instructor</label>
<select name="instructor">
<option value="john">John</option>
<option value="mary">Mary</option>
<option value="jim">Jim</option>
</select>
&lt;input type="hidden" name="date" value="&lt;?php echo $date; ?&gt;"/&gt;
&lt;input type="submit" name="submit" value="Submit" /&gt;
&lt;/form&gt;


Messages In This Thread
When I refresh a page it sends the same data - by El Forum - 10-09-2010, 08:02 AM
When I refresh a page it sends the same data - by El Forum - 10-09-2010, 08:14 AM
When I refresh a page it sends the same data - by El Forum - 10-09-2010, 09:21 AM
When I refresh a page it sends the same data - by El Forum - 10-09-2010, 09:53 AM
When I refresh a page it sends the same data - by El Forum - 10-09-2010, 11:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB