0

I have a link on a view like this

<a href="playlists/add?video[]=0&amp;video[]=4&amp;video[]=1" id="save_playlist">Save Playlist</a>

However, when it is clicked I am redirected to

/playlists/add/video[]=0&video[]=4&video[]=1

and the output of $this->params['url'] is

Array ( [url] => playlists/add/video[]=0 [video] => Array ( [0] => 4 [1] => 1 ) )

instead of

Array ( [url] => playlists/add/ [video] => Array ( [0] => 0 [1] => 4 [2] => 1 ) )

I can't work out why the firs parameter is always read as part of the url, nor why the leading ? is removed

0

1 Answer 1

1

Try playlists/add?video -> playlists/add/?video

Or just write properly formatted URLs like

$this->Html->link('Save Playlist', array('controller' => 'playlists', 'action' => 'add', 'values[0]'=>3, 'values[1]'=>2, 'values[2]'=>23)); ?>
Sign up to request clarification or add additional context in comments.

1 Comment

The variables are appended to the href by javascript so it's not making a difference how the URL is formatted initially. Changing playlists/add?video -> playlists/add/?video isn't helping either, Cake still removes the question mark

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.