PHP MYSQL自动完成/自动填充Web表单 [英] PHP MYSQL Auto complete/Autopopulate web forms

查看:329
本文介绍了PHP MYSQL自动完成/自动填充Web表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的是这样的。 jsfiddle.net/zunrk/我想创建一个收据,当您从下拉列表中选择数据时,它将在其他文本框中显示详细信息。另一个问题是我想创建多个文本框,因为将要插入多个项目。但我希望来自mysql数据库的项目不是来自数组。

What I'm trying to make is something like this. jsfiddle.net/zunrk/ I want to create a receipt that when you pick the data from the drop down it will show the details on other text box. The other problem is that i wanna create multiple textbox because there will be multiple items to be inserted. But i want the items coming from the mysql database not from an array.

推荐答案

从学习一些主题开始:

1. Javascript

2.AJAX

3. JSON



很多人建议你学习JQuery。我不会暗示这一点。我也不反对。



会是什么过程:

1.编写你的php代码以从mysql获取数据。最后以JSON格式回显它们。如果您想以简单的方式完成它,那么聚合数组中的所有数据,然后使用json_encode函数。例如:



Start with learning few topics:
1. Javascript
2. AJAX
3. JSON

Lots of people would suggest you to learn JQuery as well. I will not suggest that. I will not argue against it either.

What would be the process:
1. Write your php code to get data from mysql. Finally echo them in JSON format. If you want to do it in easy way then aggregate all data in an array and then use json_encode function. example:


result = mysql_query( SELECT * FROM sometable
result=mysql_query("SELECT * FROM sometable",


conn);


这篇关于PHP MYSQL自动完成/自动填充Web表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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