TbModal widget not working properly




        <link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->theme->baseUrl; ?>/css/styles.css" />




         <?php foreach ($model as $model): ?>


        <div class="view form coursemain ">


            <?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(

                        'id' => 'chnage-password-form',

                        'enableClientValidation' => true,

                        'htmlOptions' => array('class' => 'well'),

                        'clientOptions' => array(

                            'validateOnSubmit' => true,





            <br />

            <table class="coursetable">




                    <td class="coursetd">

                         <span class="coursetext"> <?php echo CHtml::encode($model->course_name); ?></span>





                    <td> <?php $this->beginWidget('bootstrap.widgets.TbModal', array('id'=>'myModal')); ?>

                        <div class="modal-header">

                        <a class="close" data-dismiss="modal">&times;</a>

                        <h4>Modal header</h4>



                      <div class="modal-body">


                        <span class="coursetext"> <?php echo CHtml::encode($model->course_details); ?>

                        <?php echo CHtml::encode($model->session); ?></span>



                      <div class="modal-footer">

                        <?php $this->widget('bootstrap.widgets.TbButton', array(


                            'label'=>'Save changes',



                         )); ?>

                        <?php $this->widget('bootstrap.widgets.TbButton', array(




                        )); ?>


        <?php $this->endWidget(); ?>







            <span class="tdspace"><?php $this->widget('bootstrap.widgets.TbButton', array(





                'data-target'=>'#myModal'),)); ?>


             <?php $this->endWidget(); ?>



        <?php endforeach; ?>





this is my form.It does not display different modal in each iteration(It shows same database entry i.e.course_details and session for each itearion).Please let me know where to put modal widget exactly in the form.