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:
For the sake of people who may be coming here from Google, if you're interested in having multiple of the same type of header:
It is technically possible to have multiple headers that are of the same type passed in PHP. header
has a parameter called "replace". From the documentation:
The optional replace parameter indicates whether the header should replace a previous similar header, or add a second header of the same type. By default it will replace, but if you pass in FALSE as the second argument you can force multiple headers of the same type.
So you should be able to write:
header("location: pagea.php"); #You want to overwrite the initial one, so you'd have this one be default, or true
header("location: pageb.php",false);
header("location: pagec.php",false);
Of course, if your type of header can't be had multiple times, you'll get an error. In this case you get this error (written this way in Chrome):
This page isn’t working
localhost sent an invalid response.
ERR_RESPONSE_HEADERS_MULTIPLE_LOCATION
For other headers, however, this method should work fine. The example they supply is:
header('WWW-Authenticate: Negotiate');
header('WWW-Authenticate: NTLM', false);