Last active
June 14, 2016 19:46
-
-
Save techslides/3aff93dc219657c1446276add5a54754 to your computer and use it in GitHub Desktop.
Create a repeatable section entry in Formidable Form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
We know our form has ID 1 | |
The name field has ID 5, the repeatable section has ID 10, and 2 fields in repeatabale section are ID 11 and ID 12 | |
But, how do we know that form_id is 2 below? | |
*/ | |
$parent_form_id = 1; | |
$child_name = "John"; | |
$child_age = "2"; | |
$row = FrmEntry::create(array( | |
'frm_user_id' => $user_ID, | |
'form_id' => 2, | |
'parent_item_id' => $parent_form_id, | |
'item_meta' => array( | |
11 => $child_name, | |
12 => $child_age | |
), | |
)); | |
if($row){ | |
//get array of IDs | |
$getrows=FrmEntryMeta::get_entry_meta($parent_form_id, 10); | |
//add to the array | |
$getrows[] = $row; | |
//update the form entry to include new row in repeatable section | |
FrmEntryMeta::update_entry_meta($parent_form_id, 10, null, $getrows); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment