javascript - Chosen JS does not send POST data -
i'm using chosen js plugin in order make select boxes cooler , prettier; however, something's not quite right when sending data via post php. note, i'm using codeigniter.
this html:
<select id="myselect" name="multiple[]" multiple="multiple"> <option value="1">something</option> <option value="2">something</option> <option value="3">something</option> <option value="4">something</option> </select>
this js:
$('#myselect').chosen({ max_selected_options: 4, place_holder_text_multiple: "pick poison(s)" });
finally, codeigniter model in catch data sent form , insert database.
// want them introduced in column of database together, // separated commas. $string = implode(",", $this->input->post('multiple'));
however, gets first value introduced user.
like, if him/her picked "1, 4, 5"
,
it gets "1"
.
is there missed? thank beforehand.
update checked chrome's console in order check if data being sent. got. don't have enough reputation post image, here's link.
i don't have enough reputation comment.
try casting array
$string = implode(",", (array) $this->input->post('multiple'));
or cycle array , append values string
$msg = ""; foreach($this->input->post('multiple') $key=>$val){ $msg = $msg . "," . $val; }
Comments
Post a Comment