How will I access a submodule? in local it seems fine but here it wont redirect

here’s the code

<?php
include('config.php');


if(isset($_SESSION['log'])){

    if($_SESSION['log'] == "admin"){
    header("location: Admin/admin/customer.php");
    }elseif($_SESSION['log'] == "subadmin"){
        header('location: Sub-admin/admin/attendance.php');
    }else{
       header('location: CustomerModule/index.php');
    }
}

?>

Please use Code Blocks (``` code ````) to format code.

I think your problem could be what you’ve got as the header value.
Try changing

header("location: Admin/admin/customer.php"); 

to

header("location: /Admin/admin/customer.php"); 

and see if that makes a difference.

1 Like

What do you mean “it won’t redirect”? What do you actually see?

Have you tried debugging the code yourself? Like printing the value of $_SESSION['log'], and adding print statements to make sure the code path you expect to be taken is actually taken?

What is in config.php?

Connection failed: No such file or directory

that was it states

Thankyouuuuu :heart:

2 Likes

Seems familiar:

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.