select元素中的选项取决于另一个select元素的选定值

select元素中的选项取决于另一个select元素的选定值

本文介绍了select元素中的选项取决于另一个select元素的选定值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。我在php中创建一个接口,用于从mysql数据库中提取数据。我开始做的是HTML,这是我所熟知的。 php是一个不同的故事。


我已经达到了一个点,我正在查看我创建的各种表单,并考虑一些下拉框以及用户将如何能够相应地输入数据。我在整个数据库中有很多独立的表。这些表的目的是向下拉框提供数据,以便用户可以选择所需的数据。例如:

Hello all. I am making an interface in php that will draw data from a mysql database. What I have started doing is the html, this is what I know well. php is a different story though.

I have reached a point where I am looking at the various forms I have created and thinking about some of the drop down boxes and how the user will be able to enter the data accordingly. I have throughout the database a lot of independant tables. The purpose of these tables is to provide data to a drop down box so the user can choose the desired data. For example:

展开 | 选择 | Wrap | 行号

推荐答案




感谢您对我的帖子进行标题的建议。我将在下次记住这一点。 :)

Thanks for the advice on titleing my post. I will keep that in mind for the next time. :)



是的,你是对的。我需要一组依赖的下拉框。我用谷歌搜索过,空手而归。我遇到了很多帖子,人们试图做同样的事情,但没有人成功。 (至少我还没找到一个)很多asp的东西,但不是php。

Yes, you are correct. I need a set of dependant drop down boxes. I have googled this and have came up empty-handed. I have run across a lot of posts where people are trying to do the same thing but nobody has been successful. (At least I haven''t found one yet) Lots of stuff for asp but not for php.



嗯,我已经研究过ajax,对我来说这是不可能的。我绝对没有javascript知识,而且我遇到的教程并不适合胆小的人。 tutorails还假设你已经用js编程多年了。我真的无法理解它。


php虽然不同。如果可能的话我宁愿使用php。是否有可以指向我的教程或片段?

Well, I have looked into ajax and it is out of the question for me. I have absolutely no javascript knowledge and the tutorials I have come across are not for the faint at heart. The tutorails also assume you have been programming in js for years. I really couldn''t grasp any of it.

php is different though. I would rather use php if at all possible. Is there a tutorial or a snippet you can point me to?



是,你的权利,我只是重新创建,以显示我的HTML。它实际上是一个堆叠在另一个之上。像这样:




行业


是否有更简单的方法可以做到这一点。也许甚至没有使用javascript或ajax?>


感谢您的帮助!

Yes, your right, I just recreated that to show my html. It is actually stacked one on top of the other. Like so:

District
Sector

Is there maybe an easier way to do this. Maybe without even using javascript or ajax?>

Thanks for your help!




是的...你可以使用PHP生成一个javascript ...我认为javascript是必不可少的''因为你正在处理表单..


生病了回来.. ^ ___ ^

yes... you can use PHP to generate a javascript... i think javascript is essential ''cause you''re dealing with forms..

ill be back with a script.. ^___^


这篇关于select元素中的选项取决于另一个select元素的选定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 17:25