Ask your WordPress questions! Pay money and get answers fast! (more info)

PHP add_entry to existing Gravity Form WordPress

  • SOLVED

I need a simple PHP function to add an entry in an existing form from a random page.
Like this (pseudo code):

myFunction() {
add_entry ($form_id, $entry_fields_values)
}

Answers (2)

2015-06-24

Jeremy answers:

Assuming you have the latest version of GF, you can get started with something like the following:


<?php

if ( is_page() ) {
$entry = array(
'form_id' => 3,
'1' => 'Field1_Value',
'2' => 'Field2_Value',
'3' => 'Field3_Value'
);
$entry_id = GFAPI::add_entry( $entry );
}
?>

2015-06-24

Arnav Joy answers:

you can see this..

https://www.gravityhelp.com/documentation/article/api-functions/#add_entries