Call form data when used Gsheet

Access form data when using Google Sheets integration.

Overview

The issue occurs because field names prefixed with "Gsheet" create a sub-array in the data structure, which standard PHP array syntax cannot directly access.
To retrieve the data in PHP code, reference the sub-array correctly. In email templates, use a dot notation to access the values.

Answered
An Andesch 30 Mar, 2015
I'm wondering how to write my email which is to be dynamically changed according to answers in the form. However i also want to save the information in a Google spreadsheet, hence i had to add the Gsheet before the field names. When i did that the data is no longer reached by the email php code. I managed to find in the forum where the dynamic email field should be written as Gsheet.email but cannot find how i should do in this case!
Gsheet[firstname1]
Gsheet[numberpeople]


is the field names
<?php
echo $form->data['Gsheet[firstname1]'];
?>
<br>
<?php
$Price = 1000;
$Cost = $Price * ($form->data['Gsheet[numberpeople]'] + 1);
echo $Cost;
?>
Gr GreyHead 30 Mar, 2015
Answer
1 Likes
Hi Andesch,

The PHP syntax for a sub array is like this:
$Cost = $Price * ($form->data['Gsheet']['numberpeople'] + 1);
and to show a value in an email template it would be {Gsheet.numberpeople}

Bob
This topic is locked and no more replies can be posted.