0

Save Gravity Forms Data to a Custom Database Table

[code language=”php”]
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’ )
)
);

}
[/code]

Sandeep Kumar

Sandeep kumar is a web developer and a professinal blogger. He works for latest technologies and write articles what he learn. In ICodeHub he share web languages tutorials and other programming tips and tricks. if you need some help or have some suggestion then mail him at sandeep92pal@gmail.com without any hesitation. He believes in learning and sharing.