複数の選択値をデータベースに挿入しようとしています。
HTML
<select style="width:175px" id="first" multiple="true">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</div>
<div class="mid">
<button type="button" class='add'> > </button>
<button type="button" class='remove'> < </button>
<button type="button" class='add-all'> >>> </button>
<button type="button" class='remove-all'> <<< </button>
</div>
<div class="end">
<select style="width:175px" id="second" name="second[]" multiple="true">
</select>
</div>
<div style="clear:both;"></div>
Javascript:
$('.add').click(function(){
$('#first option:selected').appendTo('#second');
});
$('.remove').click(function(){
$('#second option:selected').appendTo('#first');
});
$('.add-all').click(function(){
$('#first option').appendTo('#second');
});
$('.remove-all').click(function(){
$('#second option').appendTo('#first');
});
PHP:(php コードのごく一部)
$formvars['second'] = $this->Sanitize($_POST['second']);
$insert_query = 'insert into 'comments'(second) values ("' . $this->SanitizeForSQL($formvars['second']) . '",)';
「配列」という単語のみをデータベースに挿入します。何か案が?