I am writing a login file and I want to go back to the previous page and not the homepage after I successfully login.
public function LoginUser(){
if($checkEmail == 1){
header('refresh: 0 ; /')
}
}
I am writing a login file and I want to go back to the previous page and not the homepage after I successfully login.
public function LoginUser(){
if($checkEmail == 1){
header('refresh: 0 ; /')
}
}
I recommended you store the previous page in a $_SESSION or temporary variable where you save your previous page because not all navigators can handle history.go(-1) and like this you can guarantee the user will redirect to the right page.
Try this code. After successful login redirect to the desired page.
public function LoginUser(){
if($checkEmail == 1){
redirect('/provide your controller name/');
}
}