PDA

View Full Version : Insert hyphens into spaces in threadtitle?


KimG
05-19-2003, 12:37 PM
Hi,
I am trying to set up a feedback script which displays a feedback link at the bottom of a thread.

I want it to be a hyperlink to make a new post in a different forum category, but to use the title of the orignal post... so I use the feedback script released here in the hacks which is called by the following way in the PHP parse box in styles:

$feed = implode('', file("http://localhost/php-bin/discus3.php?topic=$thread[title]&forum=14"));

I then place $feed where I want the link to appear.

Simple except when the forum title has spaces in it! So how would I replace the spaces in $thread[title] to hyphens or similar so the script would not fail???

Any simple ideas?

Many thanks,
Kim

filburt1
05-19-2003, 01:40 PM
Instead, try using http://www.php.net/urlencode to accomodate for all weird characters.

KimG
05-19-2003, 01:49 PM
Thanks - that worked surpriingly well!