在PHP和POST选择值中拥有动态下拉列表的最佳方法是什么 [英] What is the best way to have a dynamic dropdownlist in PHP and POST selected value

查看:97
本文介绍了在PHP和POST选择值中拥有动态下拉列表的最佳方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PHP中编写以下内容:
我希望有2个下拉列表,其中第二个是根据第一个下拉列表中的选择从mySQL dB填充的。然后我想使用下拉列表中所选值的值来调用另一个PHP页面,我将在其中生成数据库查询。

I am writing the following in PHP: i would like to have 2 dropdownlists, where the second one is populated from a mySQL dB according to the choice made on the first dropdown list. Then I would like to use the values of the selected values of the dropdownlist to call another PHP page in which I will generate a db query.

例如:
清单A:汽车制造商(本田,日产等)
清单B:型号(雅阁,市政等)

Eg: List A: Car Manufactures (honda, nissan, etc) List B: Models (accord, civic, etc)

然后我会有一个提交按钮,在另一个PHP文件中POST值? (我有如何在没有动态列表的情况下执行上述操作的基础知识,但我尝试使用AJAX,但是我遇到了传递第二个下拉列表值的问题)

Then I will have a submit button, to POST the values in another PHP file? (I have the basics of how to perform the above without having a dynamic list, but I tried this with AJAX, but I am having problems to pass the value of the second dropdownlist)

有关如何执行上述操作的任何提示?

Any tips of how I can perform the above?

推荐答案

此处的解决方案:
http://www.plus2net.com/php_tutorial/php_drop_down_list.php

这篇关于在PHP和POST选择值中拥有动态下拉列表的最佳方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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