Forum Moderators: coopster

Message Too Old, No Replies

$title not displaying in <title>$title</title>

         

olokiop

5:29 am on Feb 2, 2005 (gmt 0)

10+ Year Member



For some reason $title will not display in the <title></title> using print or echo. I've tried modifying the if staments to ifelse, and even fiddled with $_GET to get this working. Tried dbl/single quotes, even changed the variable around thinking $title might be a global. nothing working yet. Any ideas?

<?php

$page == 'home';
$title == "Welcome!";

if ($page == 'home') { $title == "Welcome!"; }
elseif ($page == 'about') { $title == "about us"; }
elseif ($page == 'products') { $title == "Products"; }
elseif ($page == 'services') { $title == "Services"; }
elseif ($page == 'repair') { $title == "Upgrades & Repairs"; }
elseif ($page == 'network') { $title == "Network Solutions"; }
?>

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>My Site - <?php print "$title";?></title>
</head>
<body bgcolor="#FFE0C1">
...

olokiop

5:45 am on Feb 2, 2005 (gmt 0)

10+ Year Member



See, now this is what I get for staying up till 4am.

Comparison operators vs variable store operators.

/me figured it out.
*smacks head*

olokiop

5:47 am on Feb 2, 2005 (gmt 0)

10+ Year Member



For those coming from google as I did...

When you are using IF Statements you have to use double equal signs (==) to compare values. But when you store info into a variable you only use one (=) equal sign.

Hope this helps someone in the future. =)

dreamcatcher

9:31 am on Feb 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You might also want to look into switch statements for this kind of thing.

http://www.php.net/manual/en/control-structures.switch.php [php.net]