动态下拉菜单 [英] Dynamic Drop Down Menu

查看:80
本文介绍了动态下拉菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我对PHP很新,我创建了一个动态下拉菜单,用MySQL表中的数据填充自己。我想要做的是创建一个非动态下拉菜单,改变动态菜单中显示的内容。


例如,第一个菜单有三个城市伦敦,巴黎,新约克。如果我选择伦敦它会与来自伦敦的人一起填充第二个菜单。


这是我的动态菜单代码

Hi,

I''m fairly new to PHP and I''ve created a dynamic drop down menu that populates itself with data from a MySQL table. What I would like to do is create a non dynamic drop down menu that alters what is shown in the dynamic menu.

For example, the first menu has three cities London, Paris, New York. If I choose London it populates the second menu with people from London.

Here is the code I have for my dynamic menu

展开 | 选择 | Wrap | 行号

推荐答案

我想您可能已经忘记或不了解服务器的PHP运行及其含义。


当您请求返回所需输出的页面时,PHP在服务器上运行。这个输出可以从MySql数据库或PHP可以访问的任何其他主题获得。


这意味着如果你想使用PHP生成源代码,你必须创建一个服务器某种形式的请求。


这对于一个简单的页面来说意味着重新加载当前页面或新页面或者在IFRAME中加载页面。


但是我得到的印象是你想要一个页面上有2个选择框,并根据另一个选择框填充一个。


有可能(我从来没有这样做过)使用XML请求重新加载div中的内容,而不使用看起来像

I think you may have forgotten or not understood that PHP runs of the server and the implications of this.

PHP runs on the server as you request a page returning the required output. This output may be obtained from a MySql database or any other sourse that PHP can access.

What this means though is that if you want to generate source using PHP you have to make a server request of some sort.

In practive this means for a simple page either reloading the current or a new page or loading a page in an IFRAME.

However I get the impression that you want to have a single page with 2 selection boxes on it and fill one depending on what the selection in the other is.

It is possible (I have never done it) using XML requests to reload content in a div without reloading the rest of the page using code that looks something like

的代码重新加载页面的其余部分。
展开 | 选择 | Wrap | 行号


我必须创建一个4drop down菜单,仅启动第一个下拉菜单是列表休息三是空白然后我选择第一个下拉值然后下一个下拉菜单有相应的值然后第三个下拉将有值然后第四..

我将如何做到这一点我需要用PHP或Javascript。

aman
I have to create a 4drop down menus in starting only first drop down menu is having list rest three are blank then after i select first drop down value then next drop down menu have there corresponding values then third drop down will have there values then fourth ..
How will i do this i need in PHP or Javascript.
aman


动态下拉菜单


这篇关于动态下拉菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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