Welcome Guest, Not a member yet? Register   Sign In
Form submits more than once during redirect
#6

[eluser]eoinmcg[/eluser]
hi natsabari,

am i correct in assuming that the condition for submitting the form is ?
Code:
if($this->uri->segment(4) === 'Y'){

if you're redirecting to a url with segment 4 === Y the $argument variable will be empty but the data will be inserted into the db.

i'd recommend changing the flow of your program to sth like
Code:
<?php


    if($this->uri->segment(4) === 'Y' && isset($this->input->post('argumentLeftText')))
    {
        $argument = $this->input->post('argumentLeftText');
        $url = $this->input->post('currUrlLeft');

        log_message('DEBUG','Adding new argument-->'.$argument.' side -->'.$this->uri->segment(4).' uri-->'.$this->uri->uri_string());

        $debateArray=array
        (
            'creater_id' =>$this->dx_auth->get_user_id(),
            'debate_id' =>$this->uri->segment(3),
            'side' => $this->uri->segment(4),
            'type' => $this->uri->segment(6),
            'argument' => $argument,
            'parent_argument_id' => $this->uri->segment(5)
        );
        //print_r($debateArray);

        if(!$this->debateDb->addArgument($debateArray))
        {
            die('some problem');
        }


    }
    else
    {
        $argument = $this->input->post(''); // no need for this
        $url = $this->input->post(''); // i guess this isn't going to work...
    }


    log_message('DEBUG','Going to redirect the page to -->'.$url);
    redirect($url,'refresh');


Messages In This Thread
Form submits more than once during redirect - by El Forum - 11-12-2009, 01:55 PM
Form submits more than once during redirect - by El Forum - 11-12-2009, 02:30 PM
Form submits more than once during redirect - by El Forum - 11-13-2009, 10:54 AM
Form submits more than once during redirect - by El Forum - 11-13-2009, 11:49 PM
Form submits more than once during redirect - by El Forum - 11-14-2009, 12:27 PM
Form submits more than once during redirect - by El Forum - 11-16-2009, 08:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB