Welcome Guest, Not a member yet? Register   Sign In
daterangepicker form not working

I'm using an example of bootstrap-datetimepicker in my codeigniter project. I create a form with only the datetimepicker input.


<?php // Change the css classes to suit your needs    
       $attributes = array('class' => '', 'id' => '');
        echo form_open('/calendario/nadevent/', $attributes); ?>
       <div class="form-group">
       <label for="reservationtime">Fecha:</label>

       <div class="input-group">
       <span class="input-group-addon"><i class="fa fa-calendar"></i></span>&lt;input type="text"       name="reservationtime" id="reservationtime" class="form-control" value="&lt;?php echo       set_value('reservationtime') ?&gt;" /&gt;

   &lt;?php echo form_submit( 'submit', 'Submit','class="btn btn-default"'); ?&gt;
   &lt;?php echo form_close(); ?&gt;

$('#reservationtime').daterangepicker({timePicker: true, timePickerIncrement: 30, format: 'DD-MM-YYYY hh:mm:ss', timePicker12Hour: false, separator: '/'});

The datepicker works fine but when i submit the form, I want to format the data and split into an array:


$this->form_validation->set_rules('reservationtime', 'reservationtime', '');
        $array  = explode('/',set_value('reservationtime'));

Then I try to insert the values:

$form_data = array(
                            'start' => $array[0],
                            'end' => $array[1]

But if I print the array, its empty:

Array ( [start] => [end] => )

Wha'ts wrong with the code?

Thanks for the help Smile

Messages In This Thread
daterangepicker form not working - by El Forum - 08-14-2014, 03:12 AM
daterangepicker form not working - by El Forum - 08-15-2014, 05:12 AM
daterangepicker form not working - by El Forum - 08-15-2014, 08:29 AM

Theme © iAndrew 2016 - Forum software by © MyBB