public function actionAllocDoctorCase() { $this->authenUser(); $formAllocDoctorCase = new formAllocDoctorCase(); if (isset($_REQUEST['caseId'])) { $caseId = $_REQUEST['caseId']; if (!is_numeric($caseId)) { $this->redirect($statusCode = 404); } else { if (isset($_POST['formAllocDoctorCase'])) { $doctorId = $_POST['formAllocDoctorCase']['doctors']; echo $doctorId; // Yii::app ()->end(); $criteria = new CDbCriteria(); $criteria->condition = "doctor_did=" . $doctorId . " AND hms_patient_case_cid=" . $caseId; if (DoctorHasHmsPatient::model()->find($criteria) == null) { $addDoctAllocPat = new DoctorHasHmsPatient(); $addDoctAllocPat->doctor_did = $doctorId; $addDoctAllocPat->appointment_date = $_POST['formAllocDoctorCase']['appointment_date']; $addDoctAllocPat->hms_patient_case_cid = $caseId; $addDoctAllocPat->save(); $this->redirect(array('manage/selectPatient')); } else { Yii::app()->end(); } } } } $getDoctorsAndSpeciality = $this->getDoctorAndSpeciality(); $this->render('allocDoctorCase', array('formAllocDoctorCase' => $formAllocDoctorCase, 'doctorAndSpeciality' => $getDoctorsAndSpeciality)); }