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)
}
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 );
}
?>
Arnav Joy answers:
you can see this..
https://www.gravityhelp.com/documentation/article/api-functions/#add_entries