提问人:Jordan 提问时间:11/17/2023 最后编辑:BarmarJordan 更新时间:11/17/2023 访问量:44
尝试从 select 数组更改为 find 数组 [closed]
Trying to change from a select array to a find array [closed]
问:
第一次发帖,不确定需要什么。希望这些位置作为搜索中的结果,而不是下拉选择。
$location_select = array(
'Elm Park' => 'Elm Park',
'Rainham' => 'Rainham',
'Dagenham' => 'Dagenham',
'Romford' => 'Romford',
'Hornchurch' => 'Hornchurch',
'Upminster' => 'Upminster',
'South Ockendon' => 'South Ockendon',
'Purfleet' => 'Purfleet',
'Grays' => 'Grays',
'Stanford-Le-Hope' => 'Stanford-Le-Hope',
'Basildon' => 'Basildon',
'Pitsea' => 'Pitsea',
);
这是他们已经拥有的代码。
<form name="ph_property_search" class="ph_property_search px-2" action="<?php echo get_post_type_archive_link( 'property' ); ?>" method="get" role="form">
<div class="row mx-auto">
<div class="col-12 col-md-2 d-flex px-0">
<div class="form-group my-auto w-100 accent-right py-2 py-md-0">
<select id="location" name="address_keyword" class="location form-control area">
<option value="0" selected disabled>Location</option>
<?php
foreach($location_select as $location_option => $key ) {
echo '<option value="'.$location_option.'"'.($_POST['location'] ?? null == $location_option ? ' selected' : '').'>'. $key .'</option>';
}
?>
</select>
</div>
</div>
<script type="text/javascript">
document.getElementById('location').value = "<?php (!empty($_GET['location'])) ? print $_GET['location'] : print '0'; ?>";
</script>
<div class="col-12 col-md-2 d-flex px-0 d-flex justify-content-center justify-content-md-end pr-md-0 py-2 py-md-0">
<button type="submit" class="btn my-3 my-md-auto"><i class="fa fa-search d-md-none d-lg-inline" aria-hidden="true"></i> To Buy</button>
</div>
</div>
</form>
在网上搜索过类似的东西,也许有人可以告诉我解释我在寻找什么。
答: 暂无答案
评论
json_encode()