[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');