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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.