Jump to content

[SOLVED] & operator


the-Jerry

Recommended Posts

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

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

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.