public function actionCreate()
{
$model=new TestCheck;
//$test_title = "salma";
print_r($_POST['TestCheck']);
if(isset($_POST['TestCheck']))
{
echo "hi";
$rnd = rand(0,9999); // generate random number between 0-9999
$model->attributes=$_POST['TestCheck'];
$uploadedFile=CUploadedFile::getInstance($model,'upload_image');
$fileName = "{$rnd}-{$uploadedFile}"; // random number + file name
$model->upload_image = $fileName;
// echo '<pre>';print_r($model);die();
if($model->save())
{
// $uploadedFile->saveAs(Yii::app()->basePath.'/../images/upload_folder/'.$fileName); // image will uplode to rootDirectory/banner/
$uploadedFile->saveAs(Yii::app()->params->uploadPath.$fileName);
$this->redirect(array('admin'));
}
}
// echo "<pre>";print_r($model);die();
$this->render('create',array(
'model'=>$model,
));
}
When I print using model object it prints like below,
Undefined index: TestCheck
When I open create page its shows empty / blank page there is no form. Please help to sort out this.
Thanks,
Sally