0

我正在尝试使用 GET 创建多个搜索查询,但显示方式不同。

下面是我的视图代码:

    echo $this->form->create('Place', array('type' => 'get', 'class' => 'form-inline', 'url' => array_merge(array('action' => 'admin_index'))));

            echo $this->Form->input('province', array(
                'options' => $provinces,
                'label' => false,
                'value' => $this->request->query['province'],
                'div' => false,
            )); 
            echo " ";

            $type = array(
                ' ' => '-Choose type of place',
                'attraction' => 'Attraction',
                'hotel' =>  'Hotel',
                'restaurant' =>  'Restaurant'
            );

            echo $this->Form->input('place_type', array(
                'options' => $type,
                'label' => false,
                'div' => false,
            ));

            echo " ";

            echo $this->Form->input('title', array(
                'placeholder' => 'Enter title',
                'label' => false,
                'div' => false,
            ));

             ?>
            <input type="submit" class="btn btn-primary" value="Filter">
            <?php echo $this->Html->link('Reset', array('action' => 'index'));?>
        <?php echo $this->form->end(); ?>
    </div>

</div>

<!-- <div class="row-fluid"> 
        <div class="pagination pagination-large"> -->
        <!-- <ul>
                <?php 
                    echo $this->Paginator->numbers(array(
                    'separator' => false,
                    'tag' => 'li',
                    'currentClass' => 'active',
                    'currentTag' => 'span',
                    'modulus' => 5,
                    'first' => 1,
                    'last' => 1,
                    'ellipsis' => '<li><span>...</span></li>',
                    )); 
                ?>
            </ul> 
        </div> 
            <div class="well well-small counter"><?php echo $this->Paginator->counter(array(
            'format' => __('{:page} - {:pages} of {:count} records', true)
            )); ?></div>

</div>  end of top section row fluid -->

<div class="row-fluid">
    <div class="span14">
        <table class="table table-hover">
        <thead>
            <tr>
                <th><?php echo $this->Paginator->sort('id'); ?></th> 
                <th><?php echo $this->Paginator->sort('title'); ?></th>
                <th><?php echo $this->Paginator->sort('place_type'); ?></th>
                <th><?php echo $this->Paginator->sort('city'); ?></th>
                <th><?php echo $this->Paginator->sort('province'); ?></th>
                <th><?php echo $this->Paginator->sort('created'); ?></th>
                <th>Actions</th> 
            </tr>
        </thead>

        <tbody>
            <?php foreach ($results as $key => $place): ?>
            <tr>
                <td><?php echo h($place['Place']['id']); ?>&nbsp;</td> 
                <td>
                    <?php echo $this->Html->link($place['Place']['title'], '/spot/' . $place['Place']['slug'])?>
                </td>
                <td>
                    <?php echo $place['Place']['place_type']; ?>
                </td>
                <td>
                    <?php echo $place['Place']['city']; ?>
                </td>
                <td>
                    <?php echo $place['Place']['province'] . ", " . $place['Place']['country_code']; ?>
                </td>
                <td>
                    <?php echo $place['Place']['created']; ?>
                </td> 
                <td>
                    <?php 
                        echo $this->Html->link(
                            'Edit',
                            array('action' => 'edit', $place["Place"]["id"], 'admin' => false),
                            array("class" => "btn btn-custom")
                        ) . " "; 
                    ?>
                </td>
                <td>
                    <?php
                        echo $this->Form->create("Place", array('action' => 'delete', 'onSubmit' => 'return confirm("Do you really want to delete this content?");')); 

                        echo $this->Form->hidden("id", array("value" => $place['Place']['id']));  
                        $options = array(
                            'label' => 'Delete',
                            'class' => 'btn btn-custom', 
                        );
                        echo $this->Form->end($options); 
                    ?>
                </td> 
            </tr>
            <?php endforeach; ?>
        </tbody>
        </table> 

<div class="row-fluid">
    <div class="paging clearfix span12">
        <div class="pagination pagination-large">
        <ul><?php echo $this->Paginator->numbers(array(
            'separator' => false,
            'tag' => 'li',
            'currentClass' => 'active',
            'currentTag' => 'span',
            'modulus' => 5,
            'first' => 1,
            'last' => 1,
            'ellipsis' => '<li><span>...</span></li>',
        )); ?></ul>
        </div>
        <div class="well well-small counter"><?php echo $this->Paginator->counter(array(
            'format' => __('{:page} - {:pages} of {:count} records', true)
            )); ?></div>
    </div>
</div> 

我使用 debug() 来查看表单正在打印什么,它正在获取以下详细信息:

'<select name="data[province]" id="province">
<option value="ZSU">Zamboanga Del Sur</option>
<option value="ZSI">Zamboanga Sibugay</option>
</select>'

name= " data[province]"不应该出现,因为我使用的是 GET 类型,它应该显示这个name="province"我在这里遗漏了什么吗?先感谢您

4

0 回答 0