May just be the way the forum format things, but the following line in the first code block (function makeURL):
$text = $title;//Charachters must be in ASCII and certain ones aint allowed$text = html_entity_decode ($text);
should be two lines:
$text = $title;//Charachters must be in ASCII and certain ones aint allowed $text = html_entity_decode ($text);
Thanks,your post helped me figure it out.