Welcome Guest, Not a member yet? Register   Sign In
Date in text field
#1

[eluser]Kemik[/eluser]
Hello,

I know this is a weird question but how do you guys/girls get dates from the user? I'm trying a text field and then storing it in the database (DATE format) however the date isn't saved, just the rest of the query. I've checked all the names to make sure its not a silly mistake but they're all correct.

Fancy taking a look please?

Code:
<?php

$this->validation->set_error_delimiters('<p class="important" style="width: 300px;">', '</p>');
        
$rules['datetime']        = "trim|required|callback_datetime|xss_clean";
$rules['occurs']        = "trim|required|callback_occurs|xss_clean";
$rules['event']         = "trim|required|xss_clean|strip_tags";
        
$this->validation->set_rules($rules);
        
$fields['datetime']        = 'Date';
$fields['occurs']        = 'Occurs';
$fields['event']        = 'Event';
    
$this->validation->set_fields($fields);
        
if ($this->validation->run() == TRUE) {        
            
if ($this->input->post('occurs') == 'one-time') {
            
  $insert = array(
    'date' => $this->input->post('datetime') ,
    'details' => $this->input->post('event')
  );
    
  $this->db->insert('one_events', $insert);
                
  $data['message'] = TRUE;
}
}
?&gt;

The date is validated for dd-mm-yyyy


Messages In This Thread
Date in text field - by El Forum - 09-15-2007, 03:41 PM
Date in text field - by El Forum - 09-15-2007, 05:05 PM
Date in text field - by El Forum - 09-15-2007, 05:13 PM
Date in text field - by El Forum - 09-16-2007, 12:13 AM



Theme © iAndrew 2016 - Forum software by © MyBB