如何在 2 个下拉列表中显示 Switch/Case
我有一个包含 switch/case 的 php 文件,我相信它是 JSON 格式的。 请原谅我对 php/ajax/json 的了解,我真的很想学习这个。
<?php
switch($_GET['make']) {
case "Acura":
echo json_encode(array("MDX","RDX","RL","TL","TSX","ZDX"));
return;
case "Audi":
echo json_encode(array("A3","A4","A5","A6","A8","Q5","Q7","R8","S4","S5","S6","TT","TTS"));
return;
}
?>
这是我拥有的文件,它包含所有品牌/型号。我将如何创建一个显示所有品牌“Acura”、“Audi”的下拉列表,然后有第二个下拉列表来填充模型。如果我选择 Acura,第二个下拉列表将显示 MDX、RDX、RL、TL、多伦多证券交易所、ZDX
http://whodateswhere.com/auto/ 我在这里设置了开发站点,但它不起作用。我怎样才能让它在我的网站上运行?
感谢您的帮助!
I have a php file that contains switch/case which is in JSON I believe.
Please excuse me on my knowledge of php/ajax/json, really trying to learn this.
<?php
switch($_GET['make']) {
case "Acura":
echo json_encode(array("MDX","RDX","RL","TL","TSX","ZDX"));
return;
case "Audi":
echo json_encode(array("A3","A4","A5","A6","A8","Q5","Q7","R8","S4","S5","S6","TT","TTS"));
return;
}
?>
This is the file I have, it has all makes/models. How would I go about creating a drop downlist that shows all makes,"Acura,"Audi", then have a second dropdown that would populate with models. If I selected Acura, the second dropbox would show MDX, RDX, RL, TL, TSX, ZDX
http://whodateswhere.com/auto/
I have the dev site set-up here but it's not functional. How would I be able to make it work on my site?
Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)