With the select2 jQuery PlugIn I created a tag box. Therefore I used the following html form code:
<form action="someAction" method="post">
<fieldset>
<select id="tags" multiple="" name="tags">
<option value="tag1">val1</option>
<option value="tag2">val2</option>
<option value="tag3">val3</option>
</select>
<button type="submit" class="btn">Submit</button>
</fieldset>
</form>
Select2 generates the following field from it:
<input type="text" class="select2-input" autocomplete="off" id="s2id_autogen1" style="width: 10px;">
The problem is here that the name
attribute is missing. How can I get the data/text of the input field out of the $_POST
variable in PHP if there is no name
attribute? How can I manage this?
The setup JS is the following:
$(document).ready(function() {
$("#tags").select2({
placeholder: "Insert tag",
allowClear: true,
minimumInputLength: 2,
maximumSelectionSize: 1,
minimumWidth: 200
});
});