Jump to content

Add page title to url


bruisr

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/250910-add-page-title-to-url/
Share on other sites

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.