I have been encountering an issue where the ampersand (&) in my string is being passed through to the URL, and subsequently cut off in the browser. Is there a way to convert the ampersand in my string to "%26"? Or is there another solution? Here's the code I'm working with. $lcname= ($cname); $catlist.="<tr><td valign='top'><h3><a href='".SITEROOT."search.php?keyword=".$lcname."'></a> PHP: The URL will appear as www.site(dot)com/search.php?keyword=up_&_down The search will appear as "up_" and is missing the &_down part. Any help would be greatly appreciated. Thanks in advance for your comments.
convert it to %26. use urlencode() $lcname= ($cname); $catlist.="<tr><td valign='top'><h3><a href='".SITEROOT."search.php?keyword=".urlencode($lcname)."'></a> PHP: The & is still there
Ads2Help - That was exactly what I had been looking for. I couldn't remember how to put it together. Thanks!