Dear All,
Since 5394 (I think) a bit of code I copied from another bit to send survey responses to the respondent doesn't work:
| Code: |
//Send results as well. Currently just bare-bones - will be extended in later release
$message .= "nn----------------------------n";
foreach ($_SESSION['insertarray'] as $value)
{
$questiontitle=returnquestiontitlefromfieldcode($value);
$message .= "$questiontitle: ";
$details = arraySearchByKey($value, createFieldMap($surveyid),"fieldname", 1);
if ( $details['type'] == "T" or $details['type'] == "U")
{
$message .= "rn";
if (isset($_SESSION[$value]))
{
foreach (explode("n",getextendedanswer($value,$_SESSION[$value])) as $line) $message .= "t" . $line . "n";
}
}
elseif (isset($_SESSION[$value]))
{
$message .= getextendedanswer($value, $_SESSION[$value]);
$message .= "n";
}
}
$message .= "----------------------------nn";
//End Send results
|
This was inserted into function submittokens at line 1403 before
| Code: |
//Only send confirmation email if there is a valid email address.
|
It was taken from the function sendsubmitnotification below.
The respondent receives:
| Code: |
Token: 1234567890
Array: Yes [Y]
Array: No [N]
Etc.
|
The php error log shows:
| Code: |
Undefined variable: sourceQuestionGid in /var/www/survey/group.php on line 669
|
Changing the inserted code to the latest from
| Code: |
//v2: Send results as well. Currently just bare-bones - will be extended in later release
$message .= "nn----------------------------n";
foreach ($_SESSION['insertarray'] as $value)
{
$questiontitle=strip_tags(html_entity_decode_php4(returnquestiontitlefromfieldcode($value), ENT_QUOTES, "UTF-8"));
$message .= "$questiontitle: ";
$details = arraySearchByKey($value, createFieldMap($surveyid),"fieldname", 1);
if ( $details['type'] == "T" or $details['type'] == "U")
{
$message .= "rn";
if (isset($_SESSION[$value]))
{
foreach (explode("n",getextendedanswer($value,$_SESSION[$value])) as $line)
{
$message .= "t" . strip_tags(html_entity_decode_php4($line, ENT_QUOTES, "UTF-8"));
$message .= "n";
}
}
}
elseif (isset($_SESSION[$value]))
{
$message .= strip_tags(html_entity_decode_php4(getextendedanswer($value, $_SESSION[$value],ENT_QUOTES, "UTF-8")));
$message .= "n";
}
}
$message .= "nn----------------------------nn";
//End Send results
|
gives in php error log:
| Code: |
Undefined variable: sourceQuestionGid in /var/www/survey/group.php on line 669
html_entity_decode() expects parameter 1 to be string, array given in /var/www/survey/classes/core/html_entity_decode_php4.php on line 50
|
and following to respondent:
| Code: |
Token: 1234567890
: Yes [Y]
: No [N]
etc.
|
BTW Administrator receives full responses, but starts with:
I'm not mega php proficient, but can follow instructions.
TIA
Simon