If I can back up for a moment (only this snippet, please)
While this works on a testing page by itself:
PHP Code:
<a href="location-<? echo strtolower(str_replace(" ", "-", $city)); if ($state !=''){echo strtolower("-".$state);} ?>.php">CityState</a>
When I insert as equal to a variable from another page (includes file)this is already working, to which I am trying to add the hyphenated state:
PHP Code:
<a href="location-'.strtolower(str_replace(" ", "-", $city)).'.php">CityState</a>
But when I append the hyphenated state, it doesn't go, why? Tried with and without the echos,displacing the ending colon, etc
PHP Code:
<a href="location-'.strtolower(str_replace(" ", "-", $city)) if($state !=''){strtolower("-".$state);}.'.php">Citystate</a>
NOTE: I'm trying to check for the existence of the state variable before appending it.
Bookmarks