Can't Assign Jquery Value To Session Variable In Yii

In the following code the value item.rmid is provided by jQuery. The value is fetched from database, displayed in item.rmid and has to be stored in Yii::app()->SESSION[“rid”] but it’s not working.

In view I have the following code:







$("#pct").html('');

        $.each(<?php echo $ar; ?>, function (i, item) {


            $("#pct").append('

<div class="title">

    fss"

    <?php Yii::app()->SESSION["rid"]=' + item.rmid + ' ; ?>"

    <?php echo Yii::app()->SESSION["rid"];?>

</div>')

}




What am I doing wrong?