EDITED AS I REALISED I HAD PASTED THE WRONG CODE Our previous website developer created the below code to post the entries of a Gravity Form submission from our website into our CRM
add_action( 'gform_after_submission_37', 'post_to_click_dimensions', 10, 2 );
function post_to_click_dimensions( $entry, $form ) {
$cd_visitorkey = '';
if(isset($_COOKIE["cuvid"])){
$cd_visitorkey = $_COOKIE["cuvid"];
}
$post_url = 'http://analytics-au.clickdimensions.com/forms/h/aMvdWx4ZaEUCVF6HP8XR1o';
$body = array(
'First Name' => rgar( $entry, '1' ),
'Last Name' => rgar( $entry, '2' ),
'Email' => rgar( $entry, '3' ),
'Organisation Name' => rgar( $entry, '4' ),
'Phone' => rgar( $entry, '17' ),
'Postcode' => rgar( $entry, '13' ),
'Contact' => rgar( $entry, '6' ),
'LID' => rgar( $entry, '10' ),
'ReferringPage' => rgar( $entry, '14' ),
'I am interested in' => rgar( $entry, '16' ),
'cd_visitorkey' => $cd_visitorkey
);
I would like to add the same functionality for a different form that uses slightly different fields but when I replicate the above code and insert into functions.php I get a syntax error. So I tweaked the code to the below which doesn't give a syntax error but doesn't post the fields to the CRM - ant idea how to make the two codes work together??
add_action( 'gform_after_submission_48', 'post_to_click_dimensions', 10, 2 );
function post_to_click_dimensions( $entry, $form ) {
$post_url = 'http://analytics-au.clickdimensions.com/forms/h/aKyxSmgLocUuqSn5iUMvsw';
$body = array(
'First Name' => rgar( $entry, '2' ),
'Last Name' => rgar( $entry, '3' ),
'Email' => rgar( $entry, '4' ),
'Phone' => rgar( $entry, '5' ),
'Postcode' => rgar( $entry, '6' ),
'cd_visitorkey' => $cd_visitorkey
);
}