dt3358 2016-03-23 22:22
浏览 14

php - 在db的下拉选择器上设置默认值

I have a dropdown menu on my view that lets me select different items from the table. But, since by default there is one possible option at this instance, I want to set it instead of manually changing each one.

This is the code:

<td><?php   
        $tabindex = 1;          
        $extras = 'class = "smallInput" tabindex='.$tabindex;
        $tracking_status_array = array ();
        $tracking_status_array += array ('' => 'Select Status' );
        foreach ( $tracking_status_list as $status ) {
          $tracking_status_array += array (trim ( $status->tracking_status_id ) =>  trim ( $status->status_text )  );
        }
        echo form_dropdown ( 'tracking_status_id[]', $tracking_status_array, set_value ( 'tracking_status_id[]'), $extras);
        ?></td>
  • 写回答

1条回答 默认 最新

  • douzui6173 2016-03-23 23:57
    关注

    I dont want to remove the rest of the values because maybe in the future i might need one of those others, i only want to set one as default instead of blank as default

    评论

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程