[eluser]webnology[/eluser]
Hey Michael,
true. Here's some more info. It's the cotroller where I add the form to the db.
Code:
function addCustomer() {
//Validate if user is logged in. If not load login view
if ($this->tank_auth->is_logged_in()) {
//Set validation rules
$this->form_validation->set_rules('firstname', 'Voornaam', 'required');
$this->form_validation->set_rules('lastname', 'Naam', 'required');
$this->form_validation->set_rules('email', 'E-mail', 'required');
$this->form_validation->set_rules('birthday', 'Verjaardag dag', 'required');
$this->form_validation->set_rules('birthmonth', 'Verjaardag maand', 'required');
//Load views with data depending on error or success
if ($this->form_validation->run() == FALSE) {
//General info for the page
$data['title'] = 'Klant toevoegen';
$data['user_is_logged_in'] = $this->tank_auth->is_logged_in();
//Load form view for adding a customer
$this->load->view('v_addcustomer', $data);
}
else {
//Add data to the tables
$formdata = array(
'lastname' => $this->input->post('lastname'),
'firstname' => $this->input->post('firstname'),
'gender' => $this->input->post('gender'),
'birthday' => $this->input->post('birthday'),
'birthmonth' => $this->input->post('birthmonth'),
'address' => $this->input->post('address'),
'postalcode' => $this->input->post('postalcode'),
'city' => $this->input->post('city'),
'mobnr' => $this->input->post('mobnr'),
'fixednr' => $this->input->post('fixednr'),
'email' => $this->input->post('email'),
'memo' => $this->input->post('memo'),
'flag_sms' => $this->input->post('flag_sms'),
'flag_email' => $this->input->post('flag_email')
);
$this->db->set('user_id', $this->tank_auth->get_user_id());
$this->db->insert('customers', $formdata);
//Redirect to success page
redirect('/customers/dashboard/');
}
}
//User is logged out
else {
//General info for the page
$data['user_is_logged_in'] = FALSE;
//User needs to be logged in, redirect to login page
$data['show_captcha'] = FALSE;
//Add 1 in the 3rd segment to show that the user wants to add a band.
redirect('/auth/login/');
}
}
I also get these 2 errors:
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /var/www/html/system/core/Exceptions.php:170)
Filename: libraries/Session.php
Line Number: 671
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /var/www/html/system/core/Exceptions.php:170)
Filename: helpers/url_helper.php
Line Number: 543
All help appreciated,
Michel