Skip to content

Instantly share code, notes, and snippets.

@techslides
Last active June 14, 2016 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techslides/3aff93dc219657c1446276add5a54754 to your computer and use it in GitHub Desktop.
Save techslides/3aff93dc219657c1446276add5a54754 to your computer and use it in GitHub Desktop.
Create a repeatable section entry in Formidable Form
<?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