HELP! I was just wondering

From: Date: Fri, 01 Feb 2002 23:25:20 +0000
Subject: HELP! I was just wondering
Groups: php.general 
Request: Send a blank email to php-general+get-83459@lists.php.net to get a copy of this message
I've been playing around with php alot lately and started to scheme ways to use it-lol so heres what I tried to do: first there is a switch statement: <? switch($page) { case "refer": require("some_file.php"); exit; ?> On that some_file.php I have an elseif like so: <? if($page == $refer) { $title = "Welcome to this website"; } elseif($page == $somethingelse) { $title = "Something else than the other one"; } else { $title ="the default"; } Both these are included by: <? require('switch.php'); require('elseif.php'); ?> Then on the page where thee are required I require them at the top of the page. and I have this: <title> echo "$title"; ?> The first part of the if statement returns true always. My question is why? Arent the variables $page and $refer etc passed over? Am I going about this all wrong? It doesnt work if even in the same file as the page and not in includes. I thought that it didnt matter where we define variables in php, so I tried to define the $title in the body of an html page but that didnt work either-lol using php4 on windows and solaris is there a way to get this type of variable from any predefined HTTP variables? so I tried

« previous php.general (#83459) next »