How To Insert The Form Data In Database Without Specifying It As "required" In Rule()

Hi everyone,

I have some problems of receiving form data in Yii framework. Please spare a bit time and help me. I appreciate it a lot.

My problem is, I defined a table in database and in that table I have a column, which is NOT REQUIRED for user input (hence I didn’t specify it as “required” in rules() function in model). But at the same time, I expect to received input if any.

What I found by now is that the input for the "un-required" column will not store in the table. This is not what I want. Please help me out.

Thank you in advance.

You need to declare that attribute as safe or it won’t be honored during massive assignment.

You are fantastic, man! thank you very much. That works!

You’re welcome ;)