[eluser]elmne[/eluser]
If i want to insert post data into the database but exclude empty fields (POSTS) that a user may not have filled in, how do i achieve that?
Validation cannot stop this, as it checks only for values that are a must to fill in, but if teh user doesn't have to fill in things like all address fields and certain other fields, then these should not be input.
How do i check each POST field within the model for this?
I tried this below
Code:
if (!empty($this->input->post('title'))) { $this->title = $this->input->post('title'); }
if (!empty($this->input->post('firstname') )) {$this->firstname = $this->input->post('firstname'); }
if (!empty($this->input->post('middlename') )) {$this->middlename = $this->input->post('middlename'); }
...........
but I got this error message
Quote:Fatal error: Can't use method return value in write context