Assigning attributes to form model is playing up

I’m trying to assign the attributes of my form model from the POST data like this:




$orderform->attributes = $_POST['CheckoutForm'];



Seems straight forward and this works for most of the variables but for some reason a few variables just aren’t being set. To get around it I have to do this:




$orderform->ccexpireyear = $_POST['CheckoutForm']['ccexpireyear'];

$orderform->ccname = $_POST['CheckoutForm']['ccname'];

$orderform->ccnumber = $_POST['CheckoutForm']['ccnumber'];

$orderform->ordernum = $_POST['CheckoutForm']['ordernum'];



As you can see the attribute names and the form names are identical but it doesn’t seem to assign them in the first piece of code I posted.

I think there is something I’m missing here, any ideas?

http://www.yiiframework.com/doc/guide/1.1/en/form.model#safe-attributes-in-1-1

its probably because they are not beeing validated

Check that these variables that are not set has a validation rule or at least declare them as ‘safe’

Wow, really fast and almost synchronous answers :D