Please help me on this. I was unable to store the time into database.
The easiest way to debug this is to check the HTML source of the page (is the value being set correctly on the HTML output?) and what format does your database require the timestamp to be in? We can try as bellow
1 2 3 |
<?php echo CHtml::activeHiddenField($model,'intime',array('value'=>'10:00:00')); ?> |
Notice the single quotes around the actual time value.
Another solution
If the field is gonna be automatically filled, I’d suggest that you try to set the value in your model instead of inserting it as hidden field in the form, once the form could be easily hacked by some advanced user….so in your model try the following:
1 2 3 4 5 6 |
<?php public function beforeSave(){ $this->intime = new CDbExpression('NOW()'); return parent::beforeSave(); } ?> |
This have worked very fine to me until now!