Pretty URL for template detail pages
I have 'pretty' URLs set up for standard detail pages on my client's site where the product filters on the name instead of ID and I add hyphens between each word in the name using str_replace. However, I have another area on the site which uses PowerCMS template pages for the results and detail page, and as soon as I try to add hyphens to the Name parameter, the detail page only ever loads the first record. So, on the results page if I have the URL like this it works:
<a href="survey-detail?ID=<?php echo $row_rsSurveys['ContentGroup']; ?>
but if I change it to this, it always loads the most recent record:
<a href="survey-detail?ID=<?php echo str_replace(' ', '-', $row_rsSurveys['ContentGroup']); ?>" >
The results page is passing the URL correctly but the detail page obviously isn't recognising it with the hyphens. Is there something I need to add to the detail page to make this work?