Question: How to replace %20 characters in URL with a dash (-) when the information is coming from a MySQL db?

Code: href='details.php?listid=$record[listingid]&title=$record[title]

It currently reads:
http://www.mysite.com/details.php?listid=800&title=970%20South%20Bald%20Head%20Wynd

It should read:
http://www.mysite.com/details.php?listid=800&title=970-South-Bald-Head-Wynd

I want to keep the title words for SEO purpose unless you think it is useless??

Thank you - Merci Beaucoup – Muchas Gracias

Natasha ;)

Thanks for the link. I have been looking at it and tried different things on my site. It is complicated to say the least.
I was hoping for a simple PHP code for URL decoding (%20 "or space" to a dash).

$str = "%20";
$str2 = urldecode($str);
echo $str2;
-

Note, some browsers may change - to %20 automatically as long as it's in a link, and there's nothing you can do about it, AFAIK.

Comments
Best advice - Great code idea - Thanks SCRU

You are SOOOOOO right. It is working great in Mozilla but not in IE. THANK YOU so much for your help.
One tiny question do you think exchanging %20 with dashes help with SEO?
Have a fantastic day.

You are SOOOOOO right. It is working great in Mozilla but not in IE. THANK YOU so much for your help.
One tiny question do you think exchanging %20 with dashes help with SEO?
Have a fantastic day.

I don't know that much about SEO.

This article has been dead for over six months. Start a new discussion instead.