CodeIgniter Forums

Full Version: not inserting all values from form
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Crnaovca[/eluser]
Why?
i have form with several radio buttons and several input fields.
One radio button and one input field are not inserted in db. All others work. Since everything is same, what could be a problem? (different id and name of fields of course)

El Forum

[eluser]Crnaovca[/eluser]
Found it. It seems that I must hace form validation on that fields and then it works? Why is that?

El Forum

[eluser]SimonH[/eluser]
Hi,

the reason you are having this issue is that you are using the set_value function provided by the form_validation library to generate the values to be inserted into the DB. You will only be able to grab input for fields that have validation rules because set_value is originally meant to be used to repopulate fields with their original values to save the user from having to retype their information. In this context may I suggest using the input library to grab the information you need such that a textbox with the name "username" will be available through the following method call $this->input->post('username'). Don't worry the value returned through this will still have your validation rules applied to it.

Hope this clears up the issue.