Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('gform_after_submission_1', 'add_to_google_spreadsheet', 10, 2);
- function add_to_google_spreadsheet($entry, $form) {
- // This is the web app URL of your Google Script create in previous step
- $post_url = 'https://script.google.com/macros/s/AKfycbwFTe3H0w8bp_2yviORAGhNZzIwvmKmdaCHf KEOdORwjO6pJPQ/exec';
- // Put all the form fields (names and values) in this array
- $doctor=('doctor source => rgar($entry,3)');
- $doctorimage= explode(",",$doctor);
- $body = array('first name' => rgar($entry, '1'), 'last name' => rgar($entry, '2'),'doctor source' => rgar($entry, '3'),'doctor image1' => rgar($doctorimage[0], '4'),'doctor image2' => rgar($doctorimage[1], '5'),);
- // Send the data to Google Spreadsheet via HTTP POST request
- $request = new WP_Http();
- $response = $request->request($post_url, array('method' => 'POST', 'sslverify' => false, 'body' => $body));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement