如何在没有php的提交按钮的情况下自动将数据插入mysql数据库? [英] How to automatically insert data to mysql database without submit button in php?

查看:210
本文介绍了如何在没有php的提交按钮的情况下自动将数据插入mysql数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我需要帮助...

如何使用php自动将数据插入mysql数据库而无需提交按钮?

有没有办法呢?


非常感谢。

Hello,

I need help...
How to automatically insert data to mysql database without submit button using php?
Is there a way on this?


thanks a lot.

推荐答案

你''我必须更具体。你能举一个示例场景吗?
You''ll have to be more specific. Can you present an example scenario?


逐字回答问题(虽然这可能不会有帮助),PHP脚本不关心,如何数据交付,只要他们 交付(以某种方式)。虽然我猜它是关于用户输入的,但是一个表单(带有提交按钮)绝对是最简单和最直接的方法。
to answer the question verbatim (though that probably won?t help), the PHP script does not care, how the data are delivered, as long as they are delivered (somehow). although I guess if it is about user input, a form (with submit button) is definitely the easiest and most straightforward approach.


你好Msmjsuarez,


什么时候应该将数据插入数据库?

当用户正在提供更新数据时可能不会发生...所以你怎么知道何时应插入数据?

最简单的方法是使用提交按钮,但您始终可以使用JavaScript来确定用户是否已完成编辑。用户完成后,您可以使用Ajax将信息提交给服务器。


困难的部分将决定用户何时完成....适合提交信息。


此外,有时用户禁用JavaScript和Ajax,这可能会导致您的网页出现问题。使用< noscript>标签,如果你真的想采取这种方法。


-Frinny
Hi Msmjsuarez,

When should your data be inserted into the database?

It probably shouldn''t happen when the user is in the middle of providing updated data...so how can you tell when the data should be inserted?

An easiest approach is to use a submit button, but you could always use JavaScript to determine if the user is finished editing. Once the user''s finished you could use Ajax to submit the information to the server.

The hard part is going to be determining when the user is finished....when it is appropriate to submit the information.

Also, sometimes users have JavaScript and Ajax disabled so this may cause a problem with your web page. Use the <noscript> tags if you really want to take this approach.

-Frinny


这篇关于如何在没有php的提交按钮的情况下自动将数据插入mysql数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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