FW: [PHP] newbie... - undefined var

From: Date: Mon, 26 Aug 2002 08:17:20 +0000
Subject: FW: [PHP] newbie... - undefined var
Groups: php.general 
Request: Send a blank email to php-general+get-114111@lists.php.net to get a copy of this message
try using a switch statement. <? switch($vw) { case "": include "intro.php"; break; case "services": include "services.php"; break; case "next": include "next.php"; default: include "error.php"; break; } ?> > -----Original Message----- > From: Matt Zur [mailto:mattz@zurnet.com] > Sent: Monday, August 26, 2002 12:41 AM > To: php-general@lists.php.net > Subject: [PHP] newbie... - undefined var > > > I'm just starting to learn php and have a quick question. I'm making a > site with file includes. so for example my default page will be: > index.php and services page with be called services.php > > BUT... I want to link to services via this method: > index.php?vw=services > > Still no problem there. > > BUT on the index.php I want to write this if statement: > > if ($vw == "") { > write this code > } > > But then I get an error that the var is non defined. Do all > vars in PHP > have to be defined first? If it isn't defined, doesn't the program > assume it's value is nothing? > > -Matt

« previous php.general (#114111) next »