User email ID in form submission notification
Permalink
I am trying to display user email id in the form submission notification, and following is my code in block_form_submission.php
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$submittedData='';
foreach($questionAnswerPairs as $questionAnswerPair){
$submittedData .= "<b>".$questionAnswerPair['question']."</b>"." :- ".$questionAnswerPair['answer']."<br/>"."<br/>";
}
$formDisplayUrl=BASE_URL.DIR_REL.'/' . DISPATCHER_FILENAME . '/dashboard/reports/forms/?qsid='.$questionSetId;
$bodyHTML = t("
There has been a payment request submitted by <b><?php echo $uEmail ?></b>.<br/><br/>
%s
<br/>View Full Reports :
%s
", $submittedData, $formDisplayUrl);
But I am not getting user email ID displayed, please advise.
<?php
defined('C5_EXECUTE') or die("Access Denied.");
$submittedData='';
foreach($questionAnswerPairs as $questionAnswerPair){
$submittedData .= "<b>".$questionAnswerPair['question']."</b>"." :- ".$questionAnswerPair['answer']."<br/>"."<br/>";
}
$formDisplayUrl=BASE_URL.DIR_REL.'/' . DISPATCHER_FILENAME . '/dashboard/reports/forms/?qsid='.$questionSetId;
$bodyHTML = t("
There has been a payment request submitted by <b><?php echo $uEmail ?></b>.<br/><br/>
%s
<br/>View Full Reports :
%s
", $submittedData, $formDisplayUrl);
But I am not getting user email ID displayed, please advise.
Thanks for replying Rony, I have tried this too, currently what you suggested is what I am using, but still no go..
Maybe the variable is empty. Try to set any default test value for $uEmail and check whether it is showing or not. If yes, then you have to check, how to pass the email to template.
Rony
Rony
I am novice to PHP, not sure what you mean :(
No problem, put the below code and check whether its showing the email or not.
From the above code I've set $uEmail = 'do-not-reply@test.com'; so it will be shown in your email. If its working then let me know. I'll explain you next step.
Rony
<?php defined('C5_EXECUTE') or die("Access Denied."); $submittedData=''; $uEmail = 'do-not-reply@test.com'; foreach($questionAnswerPairs as $questionAnswerPair){ $submittedData .= "<b>".$questionAnswerPair['question']."</b>"." :- ".$questionAnswerPair['answer']."<br/>"."<br/>"; } $formDisplayUrl=BASE_URL.DIR_REL.'/' . DISPATCHER_FILENAME . '/dashboard/reports/forms/?qsid='.$questionSetId; $bodyHTML = t(" There has been a payment request submitted by <b>%s</b>.<br /><br /> %s <br />View Full Reports : %s ", $uEmail, $submittedData, $formDisplayUrl);
From the above code I've set $uEmail = 'do-not-reply@test.com'; so it will be shown in your email. If its working then let me know. I'll explain you next step.
Rony
Hi rony, did that now getting this error on submission..
Parse error: syntax error, unexpected T_FOREACH in aaaa.co.in/mail/block_form_submission.php on line 6
I think now in foreach we need to define something
Parse error: syntax error, unexpected T_FOREACH in aaaa.co.in/mail/block_form_submission.php on line 6
I think now in foreach we need to define something
Sorry I had done something wrong rony, yes now i get the value which is there in $uEail='' that is do-not-reply@test.com
Another silly question: Are you logging in as the 'user' or are you logging in as yourself (the admin)?
logging as user
Silly question but this form is only available after a user has logged in, correct?
Yes you are right, sorry i missed to mention that..
Rony