基于另一个组合框中所选项目的组合框项目 [英] Combobox items based on selected item in another combobox

查看:90
本文介绍了基于另一个组合框中所选项目的组合框项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有 combobox1 有以下项目:Fruits&

If I have a combobox1 has the items: Fruits & vegetables.

我需要根据 combobox1中的所选项目显示一个 combobox2

I need to show a nother combobox2 based on the selected item in combobox1.

如果 combobox1 中的所选项目 ,则 combobox2 项目是:apple,orange ..etc。

If the selected item in combobox1 is Fruits, then combobox2 items are: apple, orange ..etc.

combobox1 中的所选项目是 vegetables ,则 combobox2 :radish,lettuce..etc。

If the selected item in combobox1 is vegetables, then combobox2 items are: radish, lettuce..etc.

我如何使用PHP& HTML? ( 请考虑仅限PHP和HTML条件)。

How can I do that using PHP & HTML? (Please consider "PHP & HTML only" as a condition).

推荐答案

不幸的是,您的条件(仅限PHP& HTML,而不是JavaScript)意味着您应该在组合框中的每个更改后重新加载页面/加载另一个页面提交表单,因为这将是您了解

Unfortunately your conditions (PHP & HTML only, not javascript) means you should reload the page/load another page with a form submission after every change on your combobox, as it would be the only way for you to understand what is the selected value since you decided to work only server-side (PHP).

如果你决定不利用javascript(或javascript框架,如jQuery)您将无法在未提交表单的情况下修改页面中的内容,因此如果您未提交第一个组合框选择,您将无法更改第二个组合框元素。

If you decide not to take advantage of javascript (or a javascript framework such as jQuery) you won't be able to modify contents in your page without form submission, therefore you won't be able to change the second combobox elements if you didn't submitted the first combobox selection.

这篇关于基于另一个组合框中所选项目的组合框项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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