add_action('frm_after_create_entry', 'link_fields', 30, 2);
add_action('frm_after_update_entry', 'link_fields', 10, 2);
function link_fields($entry_id, $form_id){
if($form_id == 2){//Change 2 to the ID of the first form
global $wpdb;
$first_field = $_POST['item_meta'][531]; //change 531 to the ID of the field in your first form
$user = $wpdb->get_var($wpdb->prepare("SELECT user_id FROM ". $wpdb->prefix ."frm_items WHERE id=%d", $entry_id));
$entry_ids = $wpdb->get_col("Select id from ". $wpdb->prefix ."frm_items where form_id='6' and user_id=". $user);//Change 6 to the ID of the second form
foreach ($entry_ids as $e) {
$wpdb->update( $wpdb->prefix .'frm_item_metas', array('meta_value' => $first_field), array('item_id' => $e, 'field_id' => '121'));//Change 121 to the ID of the field to be updated automatically in your second form
}
}
}
I see that it updates every Entry in the original form under field ID 531 (with dropdown options of Completed, Partially Completed, Not Completed). Is there any additional code to be able to state only entries that match the unique job No. ??? So my original form with field 113 must match the number in the lookup in the second form . . . . field 110 ?? Any help would be greatly appreciated . . .
Please login or Register to submit your answer
Posting the sample code from the KnowledgeBase does nothing to help anyone troubleshoot your problem, which is probably why no one has answered your question yet. Please post your code that isn't working instead of sample code that does work.