0

I am stuck with a piece of code that i can't resolve.

I have an Entity, having some arguments. One of them is an Array.

I would like to display it in a Form as several <select> tags.

For instance, my array is called param and $param = array (a,b,c), i would like to get a html form like

 <select name='param[0]'>
      <option value='0'>0</option>
      <option value='1'>1</option>
      <option value='2'>2</option>
    </select>
    <select name='param[1]'>
      <option value='0'>0</option>
      <option value='1'>1</option>
      <option value='2'>2</option>
    </select>
    <select name='param[2]'>
      <option value='0'>0</option>
      <option value='1'>1</option>
      <option value='2'>2</option>
    </select>

Then, at the from subsmission, i would like the $param array to be inserted in the database as an array.

I have try to use de Collection type, but i couldn't resolve it. Thanks for your help !

4

1 に答える 1

0

配列の代わりに3列を使用する方がはるかに良いと思います。

このようにして、選択した各要素の値を個別の列に保存します。

于 2013-07-20T17:55:36.020 に答える