如何在codeigniter中插入多选值

时间:2016-09-28 12:19:47

标签: php codeigniter

我使用codeigniter

<select id="example-label" multiple="multiple">
    <option value="option-1">Option 1</option>
    <option value="option-2">Option 2</option>
    <option value="option-3">Option 3</option>
    <option value="option-4">Option 4</option>
    <option value="option-5">Option 5</option>
    <option value="option-6">Option 6</option>
</select>`

如何插入多选值

1 个答案:

答案 0 :(得分:1)

&#13;
&#13;
<textarea data-typeid="18" data-price="15" data-pricetype="fixed" data-index="0" name="ywapo_textarea_18[0]" cols="20" rows="4" maxlength="" class="ywapo_input ywapo_input_textarea ywapo_price_fixed"></textarea>
<input onclick="InsertText('18','Ş')" value=" Ş " type="button">
<input onclick="InsertText('18','Ş')" value=" @ " type="button">
<input onclick="InsertText('18','Ş')" value=" # " type="button">
&#13;
&#13;
&#13;

在您的控制器中添加此内容

&#13;
&#13;
<select id="example-label" multiple="multiple" name='youroption[]'>
    <option value="option-1">Option 1</option>
    <option value="option-2">Option 2</option>
    <option value="option-3">Option 3</option>
    <option value="option-4">Option 4</option>
    <option value="option-5">Option 5</option>
    <option value="option-6">Option 6</option>
</select>
&#13;
&#13;
&#13;

或使用循环

提取

&#13;
&#13;
<?php
function get_data()
{
$optiondata=$this->input->post('youroption');
var_dump($optiondata);
}
?>
&#13;
&#13;
&#13;