Is there something that I can remove% 5B% 5D to make the URL “cute” with something like htaccess?
Not. [] reserved characters in URLs, so they must be encoded in the URL .
If using POST is not an option, which makes sense, given that this is a search form, it is best to give them every other name with a value of 1 or so.
<form> <input type="checkbox" name="option1" value="1" /> <input type="checkbox" name="option2" value="1" /> </form>
Or, if you really insist that they have the same name, then you should extract the query string yourself instead of relying on the PHP-specific function to return the array when you get the parameter with the suffix [] in the name.
$params = explode('&', $_SERVER['QUERY_STRING']); foreach ($params as $param) { $name_value = explode('=', $param); $name = $name_value[0]; $value = $name_value[1];
That way you can just use the aimless name.
<form> <input type="checkbox" name="option" value="option1" /> <input type="checkbox" name="option" value="option2" /> </form>
Balusc
source share