我正在尝试使用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']); ?> </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 [省]”不应该出现,因为我使用的是GET类型,它应该显示为 name =“province”我是在这里遗失什么?提前谢谢