2

codeigniterフォームのドロップダウンを使用しています。

add_store.php コードは次のようになります:-

 <tr>
            <td>country</td>
            <td><?=form_input('country', set_value('country'));?></td>
            <td class="error"><?php echo form_error('country'); ?></td>
        </tr>
    <tr>
        <td><?=form_dropdown('Equipment',$options = array(
                                '1'   => '1',
                                '2'   => '2',
                                '3'   => '3',
                                '4'   => '4',
                                '5'   => '5',
                                '6'   => '6',
                                '7'   => '7',
                                '8'   => '8',
                                '9'   => '9',
                                '10' => '10'));?></td>
    </tr>

このフォームをデータベースに追加しましたが、正常に機能します。

このページを編集したいと思います。私はこのようなことをしています:-

edit_store.phpページはこちら

<tr>
                <td>country</td>
                <td><?=form_input('country', set_value('country', $store['country']));?></td>
                <td class="error"><?php echo form_error('country'); ?></td>
</tr>

 <tr>
                <td>Equipment Rating</td>
                <td><?=
                                $selected_Equipment = $this->input->post('Equipment');
                                form_dropdown('Equipment'$selected_Equipment);?></td>
    // what i can do here, I am doing something wrong here??????????????????????????????????????????            
</tr>

私の質問は、データベースからの選択されたドロップダウンに対して何ができるかということです。

選択した値のドロップダウンを編集する方法は?

それで、なにかお手伝いできますか ???

4

2 に答える 2

1
    <?php
    $selected_Equipment = '1';
    $options = array(
                     '1'   => '1',
                     '2'   => '2',
                     '3'   => '3',
                     '4'   => '4',
                     '5'   => '5',
                     '6'   => '6',
                     '7'   => '7',
                     '8'   => '8',
                     '9'   => '9',
                     '10' => '10');
   form_dropdown('Equipment',$options,$selected_Equipment);
   ?>

お役に立てれば!

于 2012-08-31T17:28:01.903 に答える
0

Kugutsumenは正しいです、form_dropdown関数の構文は少し間違っています。あなたはここでそれを見て、それが取る議論を見ることができます:http: //codeigniter.com/user_guide/helpers/form_helper.html

于 2012-08-31T18:09:56.620 に答える