I'm creating a form and for some fields I need to send more than one value and I do not know if the form I'm doing is the best one or not.
<select name="itens[]">
<option value=""></option>
<option value="1||Primeiro Item">Primeiro Item</option>
<option value="2||Segundo Item">Segundo Item</option>
<option value="3||Terceiro Item">Terceiro Item</option>
</select>
So I have this element that in value I'm passing both the ID
and the NOME
of the field and I'm separating it by two pipes (||), and I'm doing this because I need to store both the id and the name that was in the moment when to save.
My question is the following, does this form work? Yes, because on the other side, I can give an explode, for example and with that separate the values, but it is the correct form or it does not have a correct form, but a better one?!