Codeigniter:我如何写"选择"使用Foreach Loop的选项?

时间:2017-02-06 21:43:46

标签: php codeigniter foreach option selected

Here my problems

我怎样才能像我在图片中指定的那样制作?由于需要翻译成英文,我用图片叙述。我希望很清楚。

               <?php
                   $str = $rows[0]->oda_oz;
                      $newstr= (explode(";",$str));
                      print_r($newstr);
                      foreach ($get_ozellikler as $ozellikler ) {
                       $s=($newstr[0] ==   $ozellikler->id )? 'selected':'';  ?>
                       <option  <?php echo $s; ?> value="<?php echo $ozellikler->id; ?>" >
                        <?= $ozellikler->name; ?>
                             </option>
                                 <?php  } ?

0 个答案:

没有答案