记住DropDown选择的最简单方法? [英] Simpliest way to remember DropDown selection?

查看:76
本文介绍了记住DropDown选择的最简单方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有;

<form method="post" action="search.php">
  <select name="country">
    <option value="">Select Country</option>   
    <option value="Afghanistan">Afghanistan</option>
    <option value="Albania">Albania</option>
  </select>
</form>

然后在search.php $ country = $ country 查询MySQL表中是否有%like%国家/地区的列。

And then in search.php $country = $country query MySQL table for column that's %like% country.

我想知道在有人领取国家/地区之后记住下拉菜单选择的最简单方法是什么?

I wonder what is the simplest way to remember dropdown selection after someone makes pick up country?

推荐答案

无论您在服务器端做什么,呈现的HTML都应使用属性 selected = selected < option> 上,您希望它最初被选中。

Whatever you're doing on the server side, your rendered HTML should use the attribute selected="selected" on the <option> you want it to be initially selected.

这篇关于记住DropDown选择的最简单方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆