How do I display a html page based on a varibale: if ($q = 1) call "a1.html" else call "a2.html" I´m freshman in PHP but no in software development!
Here's something a bit more complete: <?php switch($q) { case 1: $filename = "a1.htm"; break; case 2: $filename = "a2.htm"; break; case 3: $filename = "products.htm"; break; } include "header.htm"; include $filename; include "footer.htm"; ?> PHP:
Almost. You actually want: if ($q == 1){ include("a1.html"); } else { include("a2.html"); } PHP: Notice the double equal sign in the first line.
He, I missed that too many times too. Get used to it. Every once in a while you do it and use up half an hour figuring out why your script seems to be doing something that's not supposed to be doable. That, and forgetting what argument goes where in a strpos.