i am new in yii ,i am trying to adding user comments but here i am finding some difficulty such as…
PHP notice
Undefined index: Comment
C:\xampp\htdocs\trackstar\protected\controllers\IssueController.php(244)
232 * return the project model instance to whichthis issue belongs
233 */
234 public function getProject()
235 {
236 return $this->_project;
237 }
238
239 protected function createComment($issue)
240 {
241 $comment=new Comment;
242 if(isset($_POST[‘Comment’]));
243 {
244 $comment->attributes=$_POST[‘Comment’];
245 if($issue->addComment($comment))
246 {
247 Yii::app()->user->setFlash(‘commentSubmitted’,“Your comment has been added.” );
248 $this->refresh();
249 }
250 }
251 return $comment;
252 }
253
254
255
256
Stack Trace
#0
–
C:\xampp\htdocs\trackstar\protected\controllers\IssueController.php(55): IssueController->createComment(Issue)
50 * @param integer $id the ID of the model to be displayed
51 */
52 public function actionView($id)
53 {
54 $issue=$this->loadModel($id, true);
55 $comment=$this->createComment($issue);
56 $this->render(‘view’,array(
57 //‘model’=>$issue,
58 ‘model’=>$this->loadModel($id, true),
59 ‘comment’=>$comment,
60 ));
my all codes are in files which is below…
I checked my code against the book code and didn’t find any errors. If anyone have idea it wolud be appreciated.
thanks in advance…