具有多维数组的codeigniter中的下拉输入

时间:2014-02-14 08:52:27

标签: php codeigniter

我有多维数组

[
    {
    id: "1",
    country_code: "SG",
    type: "Tourist",
    exempt_countries: "JP",
    exempt_conditions: "",
    cost: "65.00",
    markup: "10.00",
    requirements: [
        {
        id: "1",
        visa_id: "1",
        type: "card",
        title: "National Identity Card",
        desc: ""
        },
        {
        id: "2",
        visa_id: "1",
        type: "card",
        title: "Business Card",
        desc: ""
        },
        {
        id: "3",
        visa_id: "1",
        type: "letter",
        title: "Invitation Letter",
        desc: ""
        },
        {
        id: "4",
        visa_id: "1",
        type: "letter",
        title: "Introduction Letter",
        desc: ""
        },
        {
        id: "5",
        visa_id: "1",
        type: "photo",
        title: "Photograph",
        desc: ""
        },
        {
        id: "6",
        visa_id: "1",
        type: "form",
        title: "Application Form",
        desc: ""
        }
        ],
    country: {},
    price: 75
    },
    {},
    {},
    {}
]

控制器

$this->load->view('admin/visa/edit.php', compact('id','visa'));

查看

<table class="table" id='req_table'>  
        <thead>  
          <tr>  
            <th>Name</th>  
            <th>Type</th>  
            <th>Description</th>  
            <th>Remove</th>  
          </tr>  
        </thead>  

        <tbody>  
             <?php foreach($visa['requirements'] as $key => $visaa) {?>
          <tr class="row-template insert_section">                             
            <td class="row-template"> <input type="text" name="requirements[<?= $key ?>][title]" value="<?= $visaa['title']?>"/></td> 

            <td>


                <?php
                    echo form_dropdown('visa', $visaa, 'type');
                 ?>          

            </td>  

            <td><textarea class="form-control" name="requirements[<?= $key ?>][desc]"><?= $visaa['desc']?></textarea></td>  
            <td><button class='deleterow'>Delete</button></td>  

          </tr>
           <?php }?>
        </tbody> 

      </table> 

首先,我想显示需求类型值的值 我想在下拉列表中显示所有数据(需求['type'])(form_dropdown)

非常感谢

0 个答案:

没有答案