Search

If I add this to a form:

<form method="get">
  <select name="key" multiple="multiple">
    <option value="value1">Value 1</option>
    <option value="value2">Value 2</option>
    <option value="value3">Value 3</option>
  </select>
  <input type="submit" value="Submit"/>
 </form>

...and mark them all and submit the form, it results in the GET parameters ?key=value1&key=value2&key=value3.

However, Symphony generates a $url-key parameter with only the value value3, so the last value of the strings wins out. I was hoping for $url-key = 'value1, value2, value3' instead.

Is this a bug or intended behavior?

Try changing the name to name="key[]" making the field get an array instead of single value.

It's standard HTML behaviour, and I missed it the first time around too ;o)

I'll be darned. I don't know why I didn't know about that. That does indeed result in $url-key.1, $url-key.2 etc parameters, which should do what I want.

Thanks, John!

No problem.

When I use the square brackets [] they are escaped (%5B%5D) in the url.

How can I prevent the escaping?

EDIT It pass indeed an array. So solved ;-)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details