johnny5alive Posted December 26, 2015 Share Posted December 26, 2015 (edited) The script below adds a custom keyword and description to a webpage by pulling information from a field. How do I remove the comma after the "$subdivision"? Lakes at Plantation Pines, I want to add text after $subdivision but the script adds a comma? Lakes at Plantation Pines homes for sale, code below: <!DOCTYPE html> <html lang="en"> <head> <?php if (isset($_GET['action']) && $_GET['action'] == 'searchresults' && isset($_GET['L_City']) && $_GET['L_City'] != '') { $citynameraw[] = $_GET['L_City']; $cityname = str_replace("_", " ", $citynameraw[0]); $subdivision = ""; if (isset($_GET['LM_Char25_4']) && $_GET['LM_Char25_4'] != '') { $subdivision = $_GET['LM_Char25_4'] . ", "; } ?> <title> homes for sale <?php echo $subdivision; ?> real estate in <?php echo $subdivision . $cityname; ?> homes for sale in <?php echo $subdivision . $cityname; ?> real estate listings <?php echo $subdivision . $cityname; ?> real estate agents, <?php echo $cityname; ?> real estate companies, <?php echo $cityname; ?> MLS listings</title> <meta name="description" content=" homes for sale <?php echo $subdivision; ?> real estate in <?php echo $subdivision . $cityname; ?> real estate listings <?php echo $subdivision . $cityname; ?> real estate listings, <?php echo $subdivision . $cityname; ?> real estate agents, <?php echo $cityname; ?> real estate companies <?php echo $cityname; ?> MLS listings" /> <?php } else { ?> <title>{site_title}</title> {load_meta_description_short} <?php } ?> This is what the code produces: (Longs = is the city), (Lakes at Plantation Pines = is the subdivision) homes for sale Lakes at Plantation Pines, real estate in Lakes at Plantation Pines, Longs homes for sale in Lakes at Plantation Pines, Longs real estate listings Lakes at Plantation Pines, Longs real estate agents, Longs real estate companies homes for sale Lakes at Plantation Pines, real estate in Lakes at Plantation Pines, Longs real estate listings Lakes at Plantation Pines, Longs real estate listings, Lakes at Plantation Pines, Longs real estate agents, Longs real estate companies Edited December 26, 2015 by johnny5alive Quote Link to comment https://forums.phpfreaks.com/topic/300016-keyword-description-script/ Share on other sites More sharing options...
element121 Posted January 19, 2016 Share Posted January 19, 2016 It looks like the comma is added here: $subdivision = $_GET['LM_Char25_4'] . ", "; Try changing that to this: $subdivision = $_GET['LM_Char25_4']; Hope that helps, Jon Quote Link to comment https://forums.phpfreaks.com/topic/300016-keyword-description-script/#findComment-1530070 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.