phphtmlcakephpquery-stringampersand

prevent url string to encode & to &


I am using cakephp ajax pagination for my web application.

In this application i have implemented search filters also. When user filter the records, i submit the search form using GET method, in controller i get the filter variables and append them to the paginator helper like this.

$this->paginator->options(array(
    'url' => array_merge($this->passedArgs, array('?'=> $query_string)), 
    'update' => '#tlist', 
    'evalScripts' => true)
);

My problem is that in my pagination link my all & is get converted into & See below and look at the bold part.

<a href="/sites/tutor/users/ajaxtutor/page:2?gender%5B0%5D=1&gender%5B1%5D=2" id="link-1795722171" />;

And when i click on the link i do get query String as below:

[gender] => Array
        (
            [0] => 1
        )
[amp;gender] => Array
        (
            [1] => 2
        )

how to remove this extra amp; from the query string.

Can anybody help how to cope with this situation.


Solution

  • As guffa said the conversion is correct from & to &amp; as it is html standard.

    The problem was that cakephp picks pagination link's href part which contains &amp; in place of & and put it into ajax url section. See below for example: