Welcome Guest, Not a member yet? Register   Sign In
URL after insert data
#1

Hey guys,

After insert data in DB, the system returns to home page. OK. But, the url stay like 'http://localhost/code4/home/save'. If I refresh the page (F5), the insertation is made again. I want return to 'http://localhost/code4/' only. Do someone help me?

Code from the 'Home' controller:

public function save(){
$usuarioModel= new UsuarioModel();

$dados= $this->request->getPost();

$request= $usuarioModel->save($dados);

echo view('base/header');
//echo view('menu');
echo view('home/index');
echo view('base/footer');

}
Reply
#2

(This post was last modified: 04-03-2020, 07:50 PM by FoLez.)

Hello, use
PHP Code:
return redirect()->back(); 

you can read the documentation for the redirect function here https://codeigniter.com/user_guide/gener...t#redirect
Reply




Theme © iAndrew 2016 - Forum software by © MyBB