I have copied this script from Formidable and all works fine, however, the script only copies one field (first field [1562]). I have made an attempt to modify the script but with no success. Any help would be welcome.
Regards David
add_action('frm_after_create_entry', 'create_entry_after_submission', 30, 2); function create_entry_after_submission($entry_id, $form_id){
if ( $form_id != 774 ) {//Change 774 to the ID of Form A
return;
} $form2 = '773';//Change 773 to the ID of Form B
//Get user
if (!isset($_POST['frm_user_id'])){
return;
}
$user = $_POST['frm_user_id'];
//get data
if (!isset($_POST['item_meta'][15162])){ //replace 15162 with the first field ID in Form A
return;
}
$new_value = $_POST['item_meta'][15162];//replace 15162 with the field id in line 15
//create entry
FrmEntry::create(array(
'form_id' => $form2,
'item_key' => 'entry', //change entry to a dynamic value if you would like
'frm_user_id' => $user,
'item_meta' => array(
15321 => $entry_id, //change 15321 to the ID of the first name field (in Form B) with the entry ID of Form A
15318 => $user,//change 15318 to the ID of the userID field in Form B
15163 => $new_value,//Change 15163 to the ID of a first name field in Form B you want to populate with a value from Form A
),
));
}
Many thanks for your reply and advice. I will give this a try,
Re your advice above, I have tried to use it but no success. Unfortunately my skills in using PHP is very rudimentary.
Post what you tried and what the results were.
Please login or Register to submit your answer