BLeez Posted March 28, 2010 Share Posted March 28, 2010 Hi, I just tried implementing the following code into my site to generate relevant page titles by users' keyword searches. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php if ($_GET['keyword'] != "") { $keyword=ucwords(str_replace('-',' ',$_GET['keyword'])); } else { $keyword="Cool Jewelry!"; } ?> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <title><?php echo $keyword; ?></title> However, I only see my default keyword when I try testing the site with specific keywords. Any reason why this is? Any input would be appreciated. Thanks! Link to comment https://forums.phpfreaks.com/topic/196796-generate-relevant-page-titles-by-users-keyword-searches/ Share on other sites More sharing options...
ToonMariner Posted March 28, 2010 Share Posted March 28, 2010 $_GET['keyword'] is an empty string - that is the only ionstance where the if statement will not error and give the deasfult value of cool jewelry Link to comment https://forums.phpfreaks.com/topic/196796-generate-relevant-page-titles-by-users-keyword-searches/#findComment-1033093 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.