Ampersand in a list viewer

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 6, 2010   (RSS)

By jtedescojam - October 5, 2010

I have a list of coaches specializing in different sports... one of them 'Track & Field'... and when I call up the page that displays these coaches, how do I call up the coaches with that category in the URL... for example, the following doesn't work (for obvious reasons)...
http://ultimatesportsamerica.com/coaches/?sport_category=track & field
The easy fix is to change it to track and field... but I'm using this category list in a dropdown menu and the client wants the ampersand... so if there's something I need to do here, please let me know. I also need to know how to make it work for an apostraphe.

thanks ITools!
John Tedesco

Creative Director



JAM Graphics

Re: [jtedescojam] Ampersand in a list viewer

By Jason - October 6, 2010

Hi,

What you can do is use a function called urlencode to encode your category name. This will turn the ampersand into a form that the server will recognize and text and not a separator.
The code would look something like this:

<a href="http://ultimatesportsamerica.com/coaches/?sports_category=<?php echo urlencode($record['category']);?>">TEXT FOR LINK</a>

You'll have to change $record['category'] to match what you're using on the page.

Hope this helps. Let me know if you run into any issues.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/