简体   繁体   English

如何通过电子邮件将表单提交到数据库?

[英]How do I submit a form to a database from an email?

I am trying to figure out how I can email a form to someone and have them fill it out and submit it directly from the email to be entered into a MySql database via PHP. 我试图弄清楚如何通过电子邮件将表单发送给某人,让他们填写表单,然后直接从电子邮件中提交表单,以便通过PHP输入到MySql数据库中。 I have read that this is possible, but I have not seen any code on how to make this happen. 我已经知道这是可能的,但是我还没有看到任何有关如何实现此目标的代码。 I am now looking at MIME standards for emailing the form. 我现在正在寻找通过电子邮件发送表单的MIME标准。 I don't know if that is even the right way to go. 我不知道这是否是正确的方法。 Can anyone offer me a direction on this with some instruction? 有人可以通过一些指导为我提供指导吗?

The method you are suggesting sounds very difficult to implement. 您所建议的方法听起来很难实现。 I think the approach you want is to create an online web form for them to fill out, and have the data be stored in a MySQL database. 我认为您想要的方法是创建一个在线Web表单供他们填写,并将数据存储在MySQL数据库中。 Then you can just e-mail the link to the form to the people who should have it. 然后,您可以通过电子邮件将表单的链接发送给应该的人。

Parsing MIME formatted e-mail is a pain in the ass, and often doesn't work right. 解析MIME格式的电子邮件非常麻烦,通常无法正常工作。 Avoid it if at all possible. 尽可能避免使用它。

Don't. 别。

HTML support in email clients is not as good as it is in web browsers. 电子邮件客户端中的HTML支持不如Web浏览器中的HTML支持好。 They are particularly poor for HTML form support. 对于HTML表单支持,它们特别差。

Host the form on the WWW instead. 而是将表单托管在WWW上。 Include a link to it in the email. 在电子邮件中包含指向它的链接。

http://www.campaignmonitor.com/blog/post/2435/how-forms-perform-in-html-emai/ http://www.campaignmonitor.com/blog/post/2435/how-forms-perform-in-html-emai/

Theoretically, creating a web form in an Email that submits to a web-based PHP handler script (which stores the responses in a database) is identical to creating a form on a web site. 从理论上讲,在电子邮件中创建Web表单并提交给基于Web的PHP处理程序脚本(该脚本将响应存储在数据库中)与在网站上创建表单相同。

However, as you can see at the URL above, not all Email clients support HTML forms. 但是,正如您在上面的URL中看到的那样,并非所有的电子邮件客户端都支持HTML表单。 Many users may also be wary of submitting a form within an Email message, because there's no telling where its really going to take you. 许多用户也可能会担心在电子邮件中提交表单,因为无法确定表单的实际位置。

You may have also noticed that it's very easy to click on a link ;) why not just put a link in the email that takes the user to a form on your website? 您可能还注意到,单击链接非常容易;) 为什么不只是在电子邮件中放置一个将用户带到您网站上的表单的链接?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM