Hello CakePHP friends.
May I have your suggestion that how can I generate a link in a view,
which is having "?" => []
but will not clear the original param in the URL that the user is browsing?
For example,
<?= $this->Html->link("Blue", ["?" => ["color" => "blue"]]) ?>
generates a link for passing param in URL like ?color=blue
Let say, the user clicked this link, and I want to provide him another link to add 1 or more conditions.
<?= $this->Html->link("Circle", ["?" => ["shape" => "circle"]]) ?>
generates a link like ?shape=circle
.
But I hope it will be: ?color=blue&shape=circle
.
Please help. Thank you. You can just write in answer if you have one.
you can find your query params in
$this->request->query
so you can use array_merge
$query = array_merge($this->request->query, ["shape" => "circle"]);
echo $this->Html->link("Circle", $query)