Skip to content

Instantly share code, notes, and snippets.

@zjbennett
Last active August 7, 2018 13:43
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 zjbennett/cef32bdd54500e8183260da3c4b0991d to your computer and use it in GitHub Desktop.
Save zjbennett/cef32bdd54500e8183260da3c4b0991d to your computer and use it in GitHub Desktop.
G-Form Submission that take the booking form and places the submission into a table.
<?php
add_action( 'gform_after_submission_1', 'input_fields', 10, 2 );
function input_fields( $entry, $form ) {
global $wpdb;
$result = $wpdb->insert('wp_booking', array(
'booking_profname' => rgar( $entry, '4' ),
'booking_language' => rgar( $entry, '18' ),
'booking_gender' => rgar( $entry, '5' ),
'booking_date' => rgar( $entry, '7' ),
'booking_time' => rgar( $entry, '8' ),
'booking_duration' => rgar( $entry, '10' ),
'booking_interviewname' => rgar( $entry, '11' ),
'booking_id' => rgar ( $entry, '19'),
'user_id' => rgar( $entry, '23'),
'booking_type' => rgar ($entry, '24' ),
'booking_contnum' => rgar ($entry, '26'),
'booking_nature' => rgar ($entry, '30'),
));
GFCommon::log_debug( __METHOD__ . '(): result => ' . var_export( $result, true ) );
if ( $result === false ) {
GFCommon::log_debug( __METHOD__ . '(): error => ' . $wpdb->last_error );
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment