包含用户数据的 AJAX 联系表单
我构建了一个联系表单,用于检查错误并使用 AJAX 提交。问题是我还希望它获取用户数据(电子邮件、名字和姓氏)并将其存储在数据库中。
在我想实现第二个目标之前,联系表格一直运行良好。数据库是 WordPress 驱动的,因此 wp_insert_user 是一个简单的问题。显然,PHP 文件需要标头信息来访问数据库,因此我将 the_header() 添加到 PHP 文件中,但整个函数现在不起作用。我已经通过 Firebug 对其进行了测试,它应该可以工作,但没有任何反应;没有验证,也没有电子邮件。
联系表格在这里。我想知道是否有人可以解决这个问题
http://www.divethegap.com/update/contact
有什么想法吗? 编辑——
在评论中出现误解后,我从 PHP 文件中删除了有问题的 the_header() 行。现在,这将禁用将用户数据插入数据库的功能,但会向您显示表单如何工作,因此该行会导致问题。我可能会指出的一个问题并没有阻止我的任何其他 ajax 函数的工作。
I have built a contact form that checks for errors and submits using AJAX. The problem is that I also want it to take the users data (email, first name, and last name) and store it in the database.
The contact form was working fine until I wanted to accomplish the second goal. The database is WordPress driven so it was a simple matter of wp_insert_user. Obviously the PHP file needed the header information to access the database so I added the_header() to the PHP file and the entire function now does not work. I have tested it through Firebug and it should be working but nothing happens; no validation and no email.
The contact form is here. I wondered if someone could figure out the problem
http://www.divethegap.com/update/contact
Any ideas?
EDIT --
After misunderstandings in the commentary I have removed the offending the_header() line from the PHP file. This will now disable the function that would have inserted the users data into the database but will show you how the form works and thus that this line is causing a problem. A problem I may point out that has not stopped any of my other ajax functions working.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论