the-Jerry Posted August 25, 2007 Share Posted August 25, 2007 I am sending my search argument to my PHP script via the URL. (http://myserver.com/xml.php?search='searchargument') If I have it search for Rock or Rap that works fine. But as soon as "R&B" is send down to the PHP site (http://myserver.com/xml.php?search=R&B) it get's messed up. So it only sends down the "R" and igonres the rest. The mistake is definitely the "&", because it is interpreted as a second $_GET argument. Is there any way I can send the "&" sign as URL? Escape it? Ascii code? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/66694-solved-operator/ Share on other sites More sharing options...
Fadion Posted August 25, 2007 Share Posted August 25, 2007 Ure getting too problems to yourself for such a small thing: if(isset($_GET['music']) and $_GET['music'] == 'RandB'){ $music = 'R&B'; echo "Your favourite music is $music"; } Theres really no point of taking care of url variables as common users wont even look at them. Link to comment https://forums.phpfreaks.com/topic/66694-solved-operator/#findComment-334148 Share on other sites More sharing options...
BlueSkyIS Posted August 25, 2007 Share Posted August 25, 2007 "Is there any way I can send the "&" sign as URL? Escape it? Ascii code?" $a_string = urlencode($a_string); Link to comment https://forums.phpfreaks.com/topic/66694-solved-operator/#findComment-334163 Share on other sites More sharing options...
Fadion Posted August 25, 2007 Share Posted August 25, 2007 $a_string = urlencode($a_string); Ok but the url wil be "R%26B". Is that search engine friendly anyway?!! Link to comment https://forums.phpfreaks.com/topic/66694-solved-operator/#findComment-334183 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.