$model->attrubutes = $_POST['Model'] not binding values

Hi All,

Here is code snippet from my project




$car->attributes=$_POST['Car'];

//echo "<pre>";

//print_r($car);

//echo "</pre>";

$car->BrandId = $_POST['Car']["BrandId"];

$car->ModelId = $_POST['Car']["ModelId"];



As you can see, I need to explicity call $car->BrandId = $_POST[‘Car’][“BrandId”], while it should be done when

I called $car->attributes=$_POST[‘Car’].

I haven’t any clue why $car->attributes = $_POST[‘Car’] stop working.

Do anybody know why it is happening.

Thanks in Advance

This we call "massive assignment" to work attributes has to be declared as "safe"… or they need to have a validation rule defined…

Thanks for your reply. I will check it. I think it’s going to work.

Thanks a lot