I want to redirect page before insert when some condition happened and the page reloaded successfully in firebug.
my code :
$crud->callback_before_insert(array($this,'callback_function'));
the function :
$getRow1= $this->db->where('nationalityID',$getRow->id)->get('table_name')->row();
$data = array('courseID'=>$courseID,'userID'=>$getRow1->id);
$insert= $this->db->insert('table_name1',$data);
if($insert) {
$newlink = base_url()."admin/control_trainee_courses/data/". $courseID;
echo "<script>" . "window.location = '$newlink';</script>";
// or using redirect(base_url()."index.php/admin/control_trainee_courses/data/".$courseID ;
}
please help.
echo ("<SCRIPT LANGUAGE='JavaScript'>top.location.href='/index.php/';</SCRIPT>");
exit();
It will end code execution, so insert will not occur.
Also, make sure that you are redirecting to the same domain, or browser will prevent redirection.