简体   繁体   English

Wordpress-将联系表单7字段另存为数据库

[英]Wordpress - Save Contact Form 7 fields to the database as separate columns

I am using Contact Form 7 and Contact Form 7 Database Addon – CFDB7 to save values from my form to the database. 我正在使用联系表7和联系表7数据库插件– CFDB7将值从表单保存到数据库。 The database plugin seems to work fine and saves information to the database, I am able to see all my fields in the WordPress dashboard in the format I would like however it saves all the fields and values in a "serialized" form. 数据库插件似乎可以正常工作并将信息保存到数据库,我能够以我希望的格式查看WordPress仪表板中的所有字段,但是它以“序列化”的形式保存了所有字段和值。

enter code here a:17:{s:12:"cfdb7_status";s:4:"read";s:10:"user_login";s:5:"MyUser";s:4:"Date";s:10:"2018-11-20";s:10:"Name";s:3:"ABC";s:2:"BS";a:1:{i:0;s:1:"B";}s:3:"CMP";s:4:"1200";s:3:"CAB";a:1:{i:0;s:2:"CM";}s:2:"T1";s:3:"200";s:2:"T2";s:0:"";s:2:"T3";s:0:"";s:2:"SL";s:3:"150";s:8:"Calendar";a:1:{i:0;s:2:"TF";}s:8:"Period1C";s:0:"";s:8:"Period2C";s:0:"";s:2:"P1";s:1:"3";s:2:"P2";s:1:"6";s:8:"TimeType";a:1:{i:0;s:1:"M";}}

The CFDB7 plugin saves the above information in a separate table, however all the field data is saved in a single row. CFDB7插件将上述信息保存在单独的表中,但是所有字段数据都保存在一行中。 Is there a way or a plugin to save this information as separate columns in my table and all values under those columns. 有没有一种方法或插件可以将此信息另存为表中的单独列以及这些列下的所有值。 Something like this 像这样

User_login: MyUser Date: 2018-11-20 Name: ABC BS: B CMP: 1200 CAB: CM T1: 200 T2: 0 T3: 0 SL: 150 Calendar: TF Period1C: Period2C: P1: 3 P2: 6 TimeType: M 用户登录:MyUser日期:2018-11-20名称:ABC BS:B CMP:1200 CAB:CM T1:200 T2:0 T3:0 SL:150日历:TF Period1C:Period2C:P1:3 P2:6时间类型:M

where User_login, Date, Name.... are all separate columns in the table and MyUser, 2018-11-20, ABC.... are the values under these columns for every entry. 其中User_login,Date,Name ...是表中的所有单独列,而MyUser,2018-11-20,ABC ....是每个条目在这些列下的值。

Can you please advise how this can be done. 您能告诉我如何做到这一点。 The author of the plugin suggests to unserialize . 该插件的作者建议取消序列化 I have read about unserialize but I was not able to do anything with it. 我已经读过有关反序列化的内容,但是我却无能为力。 I am familiar with SQL but not with PHP yet. 我熟悉SQL,但还不熟悉PHP。 I appreciate your help. 我感谢您的帮助。

I was able to resolve this using Save Contact Form 7. I have been using it for about a month and have not encountered an issue. 我可以使用“保存联系表7”来解决此问题。我已经使用了大约一个月,并且没有遇到任何问题。

https://wordpress.org/plugins/save-contact-form-7/ https://wordpress.org/plugins/save-contact-form-7/

Edit: It is straightforward, you install the plugin, no configuration is required, it creates a custom table in the database with all the fields as separate columns. 编辑:很简单,安装插件,不需要任何配置,它在数据库中创建一个自定义表,其中所有字段都作为单独的列。 I have only used number type, text, radio button and dropdowns so far. 到目前为止,我只使用了数字类型,文本,单选按钮和下拉菜单。 Apparently, it also has the ability to save csv, pdf but I have never used it so can't tell how that works. 显然,它还具有保存csv,pdf的功能,但是我从未使用过它,因此无法告诉它是如何工作的。 I noticed that the plugin "hasn't been tested with the latest 3 major releases of WordPress", however as of now it gets the job done. 我注意到该插件“尚未经过WordPress的最新3个主要版本的测试”,但是到目前为止,它已经完成了工作。

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

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