How to declare more than one header on PHP

Posted by Homer Simpson on Stack Overflow See other posts from Stack Overflow or by Homer Simpson
Published on 2010-03-11T19:07:44Z Indexed on 2010/03/11 19:09 UTC
Read the original article Hit count: 396

Filed under:
|

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:

<?php

function one() {
     header("location: pagea.php");
}
function two() {
     header("location: pageb.php");
}
function three() {
     header("location: pagec.php");
}

?>

Of course I get an error because I am re declaring headers. At first I though it was going to be okay since I am containing them inside functions and am calling any one function at a time. But still I get the error. Is there any other way of doing this?

© Stack Overflow or respective owner

Related posts about php

Related posts about headers