表单中的自动填充字段 [英] Autofill fields in a form

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

问题描述

好的请原谅我,因为我对整个PHP编程都很陌生...


我试图做的是在表单页面上创建一个下拉列表从数据库中的信息填充。例如,一个公司名称列表,然后用这个名称填充另一个下拉列表,如果有的话,还有他们所属的部门。


一旦选择了这两个,用户点击提交它将填充下面的文本字段。例如姓名,公司,电话号码,电子邮件等等。


此时第一个下拉列表框显示但是为空。以下是我的代码:

Ok please forgive me, as I am really new to the whole PHP programming...

What I am attempting to do is on a form page create a drop down list that is populated from information in a database. For example a list of company names, then with this that would populate one more drop down list with the department they belong to if any.

Once both of those are chosen and the user hits submit it would populate text fields below. For example Name, company, phone number, email so on and so forth.

At this point the first drop down list box shows up but is empty. Here is the code I have for that:

展开 | 选择 | Wrap | 行号

推荐答案

嗨Merlin。欢迎来到TSDN!


尝试在执行之前打印查询,只是为了看到它看起来像你期望的那样。在某个地方输入拼写很容易,并且有助于将它们全部组合起来。


检查你的mysql结果是否有效总是一个好主意你上面发布的那种警告。这可以这样做:
Hi Merlin. Welcome to TSDN!

Try printing the query before you execute it, just to see that it looks as you expect it to. It''s so easy to make a typo in there somewhere and it helps to see it all combined.

It is always a good idea to check whether your mysql result is valid to avoid the kind of warning you posted above. This can be done like so:
展开 | 选择 | Wrap | 行号


我尝试了从打印查询开始到建议的一些内容屏幕。我还根据你的建议将我的查询改为公司。


它返回的是资源ID#4。这不是我的数据库中的任何地方。


所以我目前所做的只是选择公司字段并将其放在下拉列表中进行选择,但我甚至无法将其打印到屏幕上。
I tried some of the things you suggested by starting with the printing the query to the screen. I also changed my query to company as per your suggestion.

What it returns is Resource id #4. This isnt anywhere in my database.

So currently all I am trying to do is select the company field and put it in a drop down list to select from, but I cant even get that to print to the screen.



我尝试了一些你建议的事情,首先将查询打印到屏幕上。我还根据你的建议将我的查询改为公司。


它返回的是资源ID#4。这不是我的数据库中的任何地方。


所以我目前所做的只是选择公司字段并将其放在下拉列表中进行选择,但我甚至无法将其打印到屏幕上。
I tried some of the things you suggested by starting with the printing the query to the screen. I also changed my query to company as per your suggestion.

What it returns is Resource id #4. This isnt anywhere in my database.

So currently all I am trying to do is select the company field and put it in a drop down list to select from, but I cant even get that to print to the screen.



您打印的是从MySQL服务器获得的结果ID。我的意思是,打印实际的查询和错误。类似于:

What you are printing is the result ID you get from your MySQL server. What I meant is, print the actual query and the error. Something like:

展开 | 选择 | Wrap | 行号


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

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