Re: Another PHP problem

by Reywob(at)aol.com

 Date:  Sat, 22 Apr 2000 10:08:47 EDT
 To:  nik(at)cheddarcheese.de,
jmcates(at)worldnet.att.net,
hwg-languages(at)hwg.org
  todo: View Thread, Original
Thanks for that - amazing what you can miss!  That cured one problem

The problem now:
If $site isn't set then it returns an error message (reproduced below).  e.g. 
http://www.narrowgauge.f2s.com/phorum?site=pwp    works OK, but
http://www.narrowgauge.f2s.com/phorum     returns this message:
===========
Warning: Uninitialized variable or array index or property (site) in 
./include/header.php on line 4

Warning: Uninitialized variable or array index or property (site) in 
./include/header.php on line 8

Warning: Using uninitialized variable $site in 
/web/sites/31/reywob/www.narrowgauge.f2s.com/phorum/index.php on line 92 
===============

How can I get round that?  The code I'm using is:

<?PHP
if ($site == "pwp") {
$sitecss = "http://members.aol.com/reywob/newstyle.css";
$sitename = "Peters Web Page";
$siteurl = "http://members.aol.com/reywob";
} elseif ($site == "rm") {
$sitecss = "http://www.railwaymodelling.co.uk/style.css";
$sitename = "Railway Modelling";
$siteurl = "http://www.railwaymodelling.co.uk";
} else {
$sitecss = "http://www.narrowgauge.f2s.com/style.css";
$sitename = "Narrow Gauge on the web";
$siteurl = "http://www.narrowgauge.f2s.com";
}
?>

And the } else { statement is working fine.

TIA,
Peter.

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA