Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add Gravity Forms data to custom database table
add_action('gform_after_submission', 'endo_add_entry_to_db', 10, 2);
function endo_add_entry_to_db($entry, $form) {
// uncomment to see the entry object
// echo '<pre>';
// var_dump($entry);
// echo '</pre>';
$source = $entry['source_url'];
$email = $entry[5];
$param1 = $entry[2];
$param2 = $entry[3];
global $wpdb;
// add form data to custom database table
$wpdb->insert(
'custom_table_name',
array(
'source_url' => $source,
'email' => $email,
'param1' => $param1,
'param2' => $param2,
'date' => current_time( 'mysql' )
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment