I am trying to insert the submitted form data into a post. Am using the following piece of code in my_cforms_action() block in my-functions.php
function my_cforms_action($cformsdata) {
### Extract Data
### Note: $formID = '' (empty) for the first form!
$formID = $cformsdata['id'];
$form = $cformsdata['data'];
### triggers on your third form
### Do something with the data or not, up to you
### $form['Your Name'] = 'Mr./Mrs. '.$form['Your Name'];
$my_post = array();
$my_post['post_title'] = $form['Company Name'];
$my_post['post_content'] = $form['Message'];
$my_post['post_status'] = 'publish';
$my_post['post_author'] = 1;
$my_post['post_category'] = array(46);
wp_insert_post($my_post);
echo "review submitted";
### Send to 3d party or do something else
@mail('your@email.com', 'cforms my_action test', print_r($form,1), 'From: your@blog.com');
}
The problem is that it seems the function my_cform_action is never called when I press the submit button. The message at the echo is never displayed nor is the post inserted into the category 46.
Any help will be appreciated
Thank you