bruisr Posted November 11, 2011 Share Posted November 11, 2011 Hello - I have a search page that displays urls to a details page. Currently, the url looks like this: ".com/loc_details.php?loc_id=38" but I would like it to have the contents of the 'loc_name' field display after the id. Here is how it's being called in the code: $output .= "<td><a href='loc_details.php?loc_id={$row['loc_id']}'>{$row['loc_name']}</a></td>\n"; The only thing I can think of to compare it to would be the pretty links that Wordpress offers. The website for reference is www.giantstridedives.com/locations, so you can see it in action. Thanks for any help! Quote Link to comment https://forums.phpfreaks.com/topic/250910-add-page-title-to-url/ Share on other sites More sharing options...
bruisr Posted November 11, 2011 Author Share Posted November 11, 2011 OK, I figured out how to add it. $output .= "<td><a href='loc_details.php?loc_id={$row['loc_id']}&{$row['loc_name']}'>{$row['loc_name']}</a></td>\n"; Now I'm running into 2 other issues. [*]If there is a single quote in the name, such as Devil's Eye, it cuts out just before the single quote. [*]The spaces are displayed as %20. Are there ways around this with php? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/250910-add-page-title-to-url/#findComment-1287242 Share on other sites More sharing options...
RaythMistwalker Posted November 11, 2011 Share Posted November 11, 2011 Escape your single quotes with \ first: someurl.com/this\'s_my_home.html <-- in the script. won't shop up the \ in browser afaik Spaces always will be displayed as %20 in URL's as that's how servers recognise them. Quote Link to comment https://forums.phpfreaks.com/topic/250910-add-page-title-to-url/#findComment-1287248 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.