This is kinda a noob question. I have a controller that update record from a database, and then display the main page. In the update method,
function update() {
$row = $this->db->update($tablename, $data);
if($row == 1) {
$this->index();
}
}
In this case, the view goes back to the index page, but the url is still localhost/controller/update. Should I use redirect instead?
function update() {
$row = $this->db->update($tablename, $data);
if($row == 1) {
redirect(controller/index);
}
}
Which method is the correct way of redirecting pages? Thank you.