Gday,
I'm working on a thank you message and wanted to include a php if else statement.
<?php
if ({PreferedName} != "") {
echo {PreferedName};
} else {
echo {FirstName};
}
?>
This doesn't output anything, however the input fields all work outside the code.
<?php
$PN="{PreferedName}";
$FN="{FirstName}";
if ($PN != "") {
echo $PN;
} else {
echo $FN;
}
?>
Still no joy...
Any clues?
Thank you kindly
I'm working on a thank you message and wanted to include a php if else statement.
<?php
if ({PreferedName} != "") {
echo {PreferedName};
} else {
echo {FirstName};
}
?>
This doesn't output anything, however the input fields all work outside the code.
<?php
$PN="{PreferedName}";
$FN="{FirstName}";
if ($PN != "") {
echo $PN;
} else {
echo $FN;
}
?>
Still no joy...
Any clues?
Thank you kindly
Hello rickozaccess,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How can I make my PHP portable to another site?
How can I use the form data with PHP?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
How can I make my PHP portable to another site?
How can I use the form data with PHP?
P.S: I'm just an automated service😉
Based on the Bots reply, I have tried:
Still no joy...
Thank you
<?php
if ($form->data['PreferedName'] != "") {
echo $form->data['PreferedName'];
} else {
echo $form->data['FirstName'];
}
?>
Still no joy...
Thank you
Hi rickozaccess,
Your PHP looks good to me. Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.
Note: if you are using the Easy Wizard you can turn on Debug on the Others tab in CFv4 or the Setup tab in CFv5.
Bob
Your PHP looks good to me. Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.
Note: if you are using the Easy Wizard you can turn on Debug on the Others tab in CFv4 or the Setup tab in CFv5.
Bob
Gday GreaHead,
Thank you for your help.
From your reply I decided to add the script to the 'emails' as I was using it in the 'Thank you message'.
The code works for the emails, but not for the 'Thank you message'.
You can see the error on the attached image 'thankyou.jpg'.
The following is the code for the thank you message complete.
The following is the debug info.
Data Array
Errors
Debug Info
I can not see anything useful in the debug ino.
Thank you again for your time.
Thank you for your help.
From your reply I decided to add the script to the 'emails' as I was using it in the 'Thank you message'.
The code works for the emails, but not for the 'Thank you message'.
You can see the error on the attached image 'thankyou.jpg'.
The following is the code for the thank you message complete.
<div class="container" style="margin: 20px; 0 80px 0;">
<h2>Thank you for your question</h2>
<br />
<div class='cTitle'>
<h4>Hello
<?php
if ($form->data['PreferedName'] != "") {
echo $form->data['PreferedName'];
} else {
echo $form->data['FirstName'];
}
?>
,</h4>
</div>
<br />
The following is the debug info.
Data Array
Array
(
[option] => com_chronoforms5
[chronoform] => Ask_a_question-php
[event] => submit
[FirstName] => fred
[PreferedName] => fredthemagnificent
[Email] => fred@nowhere.com
[ContactNumber] => 5555555
[Questions] => Why is the sky blue
[captcha] => 2Wj4z
[ApplyNow] => Submit
[ip_address] => xxx.xxx.xxx.xxx
)
Array
(
)
Errors
Array
(
)
Debug Info
Array
(
[0] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:xxx@xxx.xxx
[2] => Subject:Logisafe: Question from fred
[3] => From name:fred
[4] => From email:xxx@xxx.xxx
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:
[9] => Attachments:
[10] => Array
(
)
[11] => Body:
<div class='sfm_table_container'>
<h2>Ask a Question</h2>
<p>You have received a question from
fredthemagnificent,</p>
<p>They are expecting that you will contact them shortly, usually within one business day.</p>
<table cellSpacing='0' cellPadding='5'>
<tr><td class='FieldName'>PreferredName</td><td class='FieldValue'></td></tr>
<tr><td class='FieldName'>Unit Code</td><td class='FieldValue'></td></tr>
<tr><td class='FieldName'>First Name</td><td class='FieldValue'>fred</td></tr>
<tr><td class='FieldName'>Email</td><td class='FieldValue'>fred@nowhere.com</td></tr>
<tr><td class='FieldName'>Contact Number</td><td class='FieldValue'>5555555</td></tr>
<tr><td class='FieldName'>Question Asked</td><td class='FieldValue'>Why is the sky blue</td></tr>
</table>
</div><br /><br />IP: 27.96.216.79
)
)
[1] => Array
(
[Email] => Array
(
[0] => An email with the details below was sent successfully:
[1] => To:fred@nowhere.com, {email}
[2] => Subject:Logisafe: Your Question
[3] => From name:Logisafe
[4] => From email:training@logisafe.com.au
[5] => CC:
[6] => BCC:
[7] => Reply name:
[8] => Reply email:
[9] => Attachments:
[10] => Array
(
)
[11] => Body:
<div class='sfm_table_container'>
<table>
<tr><td class='FieldName'>Course Name</td><td class='FieldValue'></td></tr>
<tr><td class='FieldName'>PreferedName</td><td class='FieldValue'></td></tr>
<tr><td class='FieldName'>Unit Code</td><td class='FieldValue'></td></tr>
<tr><td>Hi</td><td>fred</td></tr>
<tr><td>Your question</td><td>Why is the sky blue</td></tr>
</table>
</div>
<br /><br />IP:xxx.xxx.xxx.xxx
)
)
)
I can not see anything useful in the debug ino.
Thank you again for your time.
Hi rickozaccess,
Sorry, I missed that you had this in a Thank You Message action - for some reason that escapes me it doesn't support PHP. If you copy and paste the same code into a Custom Code element in the On Submit event it should work OK.
Bob
Sorry, I missed that you had this in a Thank You Message action - for some reason that escapes me it doesn't support PHP. If you copy and paste the same code into a Custom Code element in the On Submit event it should work OK.
Bob
Evening Grey Head,
Thank you for the work around, it works!
Kind regards, enjoy your coffee...
Rick
Thank you for the work around, it works!
Kind regards, enjoy your coffee...
Rick
This topic is locked and no more replies can be posted.