dsnrixf6765
dsnrixf6765
2015-09-04 09:09

Ajii删除yii

  • yii
  • php
  • ajax

How can I put a ajax delete button for delete the comment by the posted user?
_form

 echo '<div><h3><b><u>Comments</u></b></h3></div>';

 $commentList = Comments::model()->findAllByAttributes(array('offereventid'=>$id));
     foreach($commentList as $Listdata2)
     {   
        $usercomment = $Listdata2['comment']; 
        $usercommentid = $Listdata2['id'];          
        $usercomtname = $Listdata2['name'];         
        $usercommentmail = $Listdata2['email'];      
        echo '<div><span class="name1">'.$usercomtname.':</span> '.'<span class ="email1">'.'['.$usercommentmail.']'.'</span>'.'</div>';            
        echo '<div class = "cmnts" >'.'"'.$usercomment.'"'.'['.$usercommentid.']'.'</div>';
        // echo CHtml::ajaxSubmitButton('Delete ', array('delete', 'id'=>$usercommentid)); 

        echo '<hr>';    
     } 

please help me with it. I tried lot of methods but when i tried any user can delete the comment of any user.

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐