需要帮助自动加载列表框内容,无需刷新页面或按钮 [英] need help with auto load of listbox contents without page refresh or button

查看:67
本文介绍了需要帮助自动加载列表框内容,无需刷新页面或按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个表1是status_type,具有字段名称状态,其他是具有字段用户名和状态的用户


现在我希望第一个列表框列出状态类型的所有状态(这我已经实现了php)


并根据列表框1中值的选择,表用户中的相应数据将被加载到列表框2中。


i已经通过在php中使用按钮实现了这一点,但我希望它在没有提交按钮且没有页面刷新的情况下运行


类似于 http://www.plus2net.com/php_tutorial/dd.php 我不知道javascript因此无法弄清楚wat在哪里进行更改


这里是我的代码,它与php中的提交按钮一起使用... plz帮帮我

i have 2 tables 1 is status_type with field name status and other is users with field username and status

now i want that the first listbox lists all status from status type ( this i have achieved with php )

and based on selection of the value in listbox 1 the corresponding data in table users be loaded in listbox 2 .

i have achieved this by using a button in php but i want tht it operate without submit button and no page refreshing

something like whats shown in http://www.plus2net.com/php_tutorial/dd.php i donno javascript so cant figure out wat and where to make the changes

here is my code which works with a submit button in php...plz help me out

展开 | 选择 | Wrap | 行号

推荐答案

至少有两种方法可以执行此操作:

1.在页面加载时加载所有数据(使用PHP生成JavaScript代码),然后使用JavaScript填充列表框。

2.使用Ajax - 调用一个PHP脚本,它返回选项并将select设置为。


您更喜欢哪种?
There''s at least two ways in which you could do this:
1. Loading all the data on page load (using PHP to generate JavaScript code) and then using JavaScript to populate the list box.
2. Using Ajax- call a PHP script which returns the options and set the select to that.

Which do you prefer?


第一个听起来像wat我提到
the first one sounds like wat i mentioned


所以,使用PHP,生成这样的东西(假设状态类型是一个数字):
So, using PHP, generate something like this (assuming status type is a number):
展开 | 选择 | Wrap | 行号


这篇关于需要帮助自动加载列表框内容,无需刷新页面或按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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