我有一个带有输入类型的 jquery ui 对话框,我在其中放置了一个邮政编码,以便人们可以使用他们的邮政编码进行搜索。
现在我想做一个半径从 5 到 25 公里的下拉菜单。
我怎样才能做到这一点?因为我是 setcookie 选项的新手。
我的下拉代码
<select>
<option disabled selected>Afstand</option>
<option>5km</option>
<option>10km</option>
<option>15km</option>
<option>25km</option>
</select>
这是我的 cookie 代码 + 对话框 div:
<div id="dialog" class="hidden" title="Welkom bij OostWestRegioBest.nl">
Zoeken in uw regio.
<br/><br/>
<form method="post" action"">
<input type="text" name="postcode" placeholder="postcode">
<br/><br/>
//
**// Here will be my select dropdown**
//
<input type="submit" value="Opslaan">
<input type="hidden" name="submitted" value="true">
<input type="hidden" name="afstand" value="true" />
</form>
<?php
if(isset($_POST['postcode']))
{
setcookie('postcode', $_POST['postcode'], time() + (20 * 365 * 24 * 60 * 60));
header("location: {$_SERVER['PHP_SELF']}");
};
?>
在这里我的代码显示邮政编码的cookie:
<input type="text" name="postcode" value='<?php echo isset($_COOKIE['postcode']) ? $_COOKIE['postcode'] : '' ?>'>
提前致谢。