Question: When we use GET method we use ambersand(`&`) sign to send the data to a particular script. I'm sending data to a php script called `myscript.php` by the GET method from a javascript like the following :

```
http.open('GET', 'Myscript.php'+ '?d=' + value1 + '&c=' + value2 + '&f=' + value3);

```

But if the value1 or value2 or value3 contains an `&` sign in their actual value (for example if somebody enter for the value1 `garth&ggg&kkk` then the `Myscript.php` can't handle the value1 properly because it contains an `&` sign in the actual data. It takes the value `garth` for value1.

My php code is as follows:

```
if (isset($_GET['d'])) {  $a =  $_GET['d'];}

```

Answer: 
You need to encode it properly before putting it into url to turn ampersand to `%26`:

* in PHP: `urlencode()`
* in javascript: `encodeURIComponent()`

You don't need to decode it in PHP, it will decode it for you to `&` character.
JS you can use

```
encodeURIComponent(str);

```

Example

```
str="garth&ggg&kkk";
str=encodeURIComponent(str);

```

It will replace & with %26