Forums

E-Mail Template HTML Editor destroy PHP Code

Chris1984NRW 18 Jan, 2014
Hey there,

I would like to build the e-mail template with an php request, to hide the field {recipient1} if this is empty.

This is my code to do this

<?php 
echo "<table border='0' cellspacing='5' cellpadding='5'>";
echo "<tbody>";
echo "<tr>";
echo "<td><strong>Name*</strong></td>";
echo "<td>{input_name}</td>";
echo "</tr>";
echo "<tr>";
echo "<td><strong>E-Mail*</strong></td>";
echo "<td>{input_email}</td>";
echo "</tr>";
echo "<tr>";
echo "<td><strong>Fanclub</strong></td>";
echo "<td>{input_fanclub}</td>";
echo "</tr>";
echo "<tr>";
echo "<td><strong>Spiel</strong></td>";
echo "<td>{input_spiel}</td>";
echo "</tr>";
echo "<tr>";
echo "<td><strong>Einstiegsort</strong></td>";
echo "<td>{input_einstiegsort}</td>";
echo "</tr>";
if ( isset($form->data['recipient1']) && $form->data['recipient1'] )
{ 
echo "<tr>";
echo "<td><strong>Mitfahrer 1</strong></td>";
echo "<td>{recipient1}</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
?>



After I update my e-mail template this is the result:
"; echo ""; echo ""; echo "Name*"; echo "{input_name}"; echo ""; echo ""; echo "E-Mail*"; echo "{input_email}"; echo ""; echo ""; echo "Fanclub"; echo "{input_fanclub}"; echo ""; echo ""; echo "Spiel"; echo "{input_spiel}"; echo ""; echo ""; echo "Einstiegsort"; echo "{input_einstiegsort}"; echo ""; if ( isset($form->data['recipient1']) && $form->data['recipient1'] ) { echo ""; echo "Mitfahrer 1"; echo "{recipient1}"; echo ""; } echo ""; echo ""; ?>


Where is my mistake?

Can anybody help me?

Best regards

Chris1984NRW
GreyHead 18 Jan, 2014
Hi Chris,

Please try turning off the Rich Text Editor. If you want to add PHP then just use the plain textarea box.

Bob
Chris1984NRW 20 Jan, 2014
How does it run in the email Template with the Textarea?

I doesnt speak from the Form Designer
GreyHead 20 Jan, 2014
Hi Chris1984NRW,

Sorry, I don't understand your post :-(

Bob
Chris1984NRW 20 Jan, 2014
My contact Form is ready.
Now i design the email which would be sent to the email Adress.
And this Code is for this email
Max_admin 20 Jan, 2014
Hi Chris,

Where do you place this code ? it should be saved in the "Template" field under the "Email" settings, but when you do this, do NOT enable the "editor", just leave it disabled.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Chris1984NRW 21 Jan, 2014
I dont understand what you mean.

Now an Screenshot from my Screen:
GreyHead 21 Jan, 2014
Hi Chris1984NRW,

You need to switch to the Form Wizard to do this. Please see this FAQ

Bob
Chris1984NRW 21 Jan, 2014
Thanks, thanks thanks!!
Now its OK!

Thanks for this great and fast support!
Chris1984NRW 21 Jan, 2014
But now, i have the next problem.

I had copy the correct php code from the email event template to the event show thanks message.

this is the result:
Vielen Dank für Ihre Anmeldung. Folgende Daten haben wir von Ihnen erhalten: data['recipient1']) && $form->data['recipient1'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient2']) && $form->data['recipient2'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient3']) && $form->data['recipient3'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient4']) && $form->data['recipient4'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient5']) && $form->data['recipient5'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient6']) && $form->data['recipient6'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient7']) && $form->data['recipient7'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient8']) && $form->data['recipient8'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient9']) && $form->data['recipient9'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient10']) && $form->data['recipient10'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient11']) && $form->data['recipient11'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient12']) && $form->data['recipient12'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient13']) && $form->data['recipient13'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient14']) && $form->data['recipient14'] ) { echo ""; echo ""; echo ""; echo ""; } if ( isset($form->data['recipient15']) && $form->data['recipient15'] ) { echo ""; echo ""; echo ""; echo ""; } ?>
Name* Test
E-Mail* test@test.de
Fanclub test
Spiel fcb-bvb
Einstiegsort hagen
Mitfahrer 1 a
Mitfahrer 2 5
Mitfahrer 3 bb
Mitfahrer 4 bbb
Mitfahrer 5 ss
Mitfahrer 6 555
Mitfahrer 7 ssss
Mitfahrer 8 aaa
Mitfahrer 9 www
Mitfahrer 10 6567
Mitfahrer 11 zzz
Mitfahrer 12 qq
Mitfahrer 13 xxx
Mitfahrer 14 zzz
Mitfahrer 15 iii
Nachricht dasdasdasd

Can I use php-code in the thanks message?
GreyHead 21 Jan, 2014
Hi Chris1984NRW,

No you can't, but you can use a Custom Code action instead.

Bob

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