Hi all,
I have a problem when reading the get variables.
I have one select box like this;
<select name=“url” id=“url”
onChange=“getTwo(‘example.php?name=’+this.value)”>
But, in the select box items, some values are having ‘abc&xyzlmn’ like that…
If that ‘&’ contained value is selected,
when i read GET variable in the example.php page,
i didn’t get the whole value of selected value…(i.e abc&xyzlmn).
How to read the whole selected value, in my php get variable.?
Give me any solution for this…
Thanking you…
Just a guess using PHP: htmlentities:
<select name="url" id="url" onChange="getTwo('example.php?name='+this.value)">
<option value="<?php htmlentities('abc&xyzlmn'); ?>"><?php htmlentities('abc&xyzlmn'); ?></option>
This will change abc&xyzlmn to abc&xyzlmn
Thank you for your reply…
no, its not getting the whole value.
This is a JavaScript issue, you want to use [encodeURIComponent](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/encodeURIComponent)
around the value.
Thank you Salathe…
By using this;
getTwo(‘example.php?name=’ + encodeURIComponent(this.value))
i solved my problem…