Inserting Data Using Cgridview

I followed this tutorial which explains the technique of updating a certain record using CGridView. I did a few modifications to the system in order to insert records to my database using this CGridView. However it doesn’t seem to function at the moment although I have verified that every variable is set and not null or anything

My modified actionUserInputSave method

    $orderId =$_POST['ordId'];


$b =HospOrderPkgDetails::model()->findByPk($orderId);	


$b->item =$_POST['item'];			


$b->currentQty =$_POST['currentQty'];


$b->requiredQty=$_POST['requiredQty'];	


$b->notes=$_POST['notes'];	


$b->save();

actionUserInputData

    $orderId =$_GET['ordId'];	


$b =HospOrderPkgDetails::model()->findByPk($orderId);


$res =array(


	 'item'=>$item[0],


	 'currentQty'=>$currentQty[0],


	 'requiredQty'=>$requiredQty[2],


	 'notes'=>$notes[3],


);


echo CJSON::encode($res);

In the form I created the hidden field by getting the value from another textbox

$a->orderId;

echo $form->hiddenField($a,‘orderId’);

echo CHtml::hiddenField(‘ordId’, ‘orderId’);

There are 4 textboxes in my system, item, currentQty, requiredQty and notes. None of them are datetimepicker

Any ideas on how this could be accomplished