I want to send my users to different pages based on user action. So I made multiple functions at the top of the page like so:
I think you misunderstand what the HTTP header Location does.
The Location header instructs the client to navigate to another page. You cannot send more the one Location header per page.
Also, PHP sends headers right before the first output. Once you output, you cannot specify any more headers (unless you are using Output Buffering).
If you specify the same header twice, by default, header() will replace the previous value with the latest one... For example:
will redirect the user to c.php, never once passing by a.php or b.php. You can override this behavior by passing a false value to the second parameter (called $replace):
The Location header can only be specified once. Sending multiple Location header will not redirect the users to the pages... It will probably confuse the crap out of the UA. Also, understand that the code continues to execute after sending a Location header. So follow that call to header() with an exit. Here is a proper redirect function:
function redirect($page) {
header('Location: ' . $page);
exit;
}