I managed to replace special characters such as : ; / etc in my URL but now it has the spaces again. Here is my code:
<h3><a href="<?php echo (isset($row_getDisplay['post_id']) ? $row_getDisplay['post_id'] : ''); ?>_<?php echo str_replace(array(':', '\\', '/', '*'), ' ', urldecode($row_getDisplay['title'])); ?>.html" ><?php echo (isset($row_getDisplay['title']) ? $row_getDisplay['title'] : ''); ?></a></h3>
I want it to like it is remove special characters as well as replace spaces with dashes.
Try str_replace(' ', '-', $string);