我想使用以下代码将Contact Form 7插件的字段值保存在数据库中:
add_action('wpcf7_before_send_mail', my_conversion($cf7));
function my_conversion($cf7)
{
$name = $cf7->posted_data["your-name"];
$email = $cf7->posted_data["your-email"];
$Work = $cf7->posted_data["tel-Work"];
$homenumber = $cf7->posted_data["homenumber"];
$mobilenumber = $cf7->posted_data["mobilenumber"];
mysql_query("INSERT INTO `hello` (`Your Name`, `Work`, `Home`, `Mobile No`, `Email`) VALUES ('$name',$Work,$homenumber,$mobilenumber,$email)");
}
但它不起作用,这是错误:
"`$cf7->posted_data["...."]`;" can not fetch values.