Sadly I'm too thick to learn PHP. Would someone please kindly take a look at the code below and tell me how to make what I want? I want to GET the searchtext OR city (that someone is searching on my site) ELSE print the site title. At the moment the script below GETS the searchtext ELSE prints title. <?php if ($_GET[searchtext]) { $title = "<title>"; $title .= $_GET[searchtext]; $title .= " - Holiday Villas To Rent"; $title .= "</title>"; echo $title; } else { ?> <title>{site_title}</title> <?php } ?> PHP: I have tried what's written below and it does not like that!! Many thanks for looking. <?php if ($_GET[searchtext]) OR ($_GET[city]){ $title = "<title>"; $title .= $_GET[searchtext]; $title .= " - Holiday Villas To Rent"; $title .= "</title>"; echo $title; } else { ?> <title>{site_title}</title> <?php } ?> PHP:
I've completely changed the code: <?php $title = ''; if (!empty($_GET['searchtext'])) $title = $_GET['searchtext']; else if (!empty($_GET['city'])) $title = $_GET['city']; if ($title) { $title = "<title>$title - Holiday Villas To Rent</title>"; echo $title; } else { ?> <title>{site_title}</title> <?php } ?> PHP:
$title = $_GET['searchtext'] != '' ? $_GET['searchtext] : $_GET['city']; if($title){ $title = "$title holydays"; }else{ $title = (site title); } echo "<title>$title</title>"; something like this