Welcome Guest, Not a member yet? Register   Sign In
Inserting post data
#1

[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


Messages In This Thread
Inserting post data - by El Forum - 06-06-2010, 08:27 PM
Inserting post data - by El Forum - 06-06-2010, 11:46 PM
Inserting post data - by El Forum - 06-07-2010, 12:48 AM
Inserting post data - by El Forum - 06-07-2010, 04:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB