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

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.


   function Welcome()

   function forms(){
            $data['header']='input form';
            $data['title']='input form';
            if ($this->input->post('start_time')){
                redirect('welcome/forms', 'refresh');

// 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'),

// 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>
&lt;input type="hidden" name="date" value="&lt;?php echo $date; ?&gt;"/&gt;
&lt;input type="submit" name="submit" value="Submit" /&gt;

Everythinbg seems fine, except maybe 2 things :
1) try : redirect('welcome/forms');exit();
2) your form is vulnerable to xss attacks Wink try :
$data = array(
            'date' => $this->input->post('date',TRUE),
            'start_time' => $this->input->post('start_time',TRUE),
            'finish_time' => $this->input->post('finish_time',TRUE),
            'instructor' => $this->input->post('instructor',TRUE),

Thanks for your reply and tips.

However it still re-send when I refresh or F5.

I noticed that it happens with FF but not Chrome.

I am using Ubuntu.

Any idea?

Maybe the browser is caching the page!


Theme © iAndrew 2016 - Forum software by © MyBB