I am trying to get a jquery array into a html input and I can't figure out where I am wrong.
HTML:
<input type="hidden" id="datepicker" name="dates[]" />
Jquery:
<script>
$('#datepicker').datepick({
dateFormat: 'yyyy-mm-dd',
multiSelect: '100'
});
$(document).ready(function() {
$("#butto").click(function() {
var dates = $('#datepicker').datepick('getDate');
console.log(dates);
$('#datepicker').val(dates);
});
});
</script>
PHP:
$dates= $this->input->post('dates');
foreach($dates as $datee) {
print_r($datee);
}