Forums

checkbox depending thank you message

Tiko 07 Apr, 2014
Hello,
I would like to insert different download links into my thank you message depending on the choices in my checkbox group.
Is this possible, and what would be the easiest way for a PHP noob?
Thank you in advance,
Tiko.
GreyHead 07 Apr, 2014
Hi Tiko,

It's certainly possible and a PHP Switch statement is probably the simplest way to do it.

Bob
Tiko 07 Apr, 2014
ok, I'll google PHP switch statement and if can't sort it out on my own I'll be back. Thank you for your patience.
Tiko.
Tiko 10 Apr, 2014
ok, I looked around a bit. Should I put the switch statement directly into the thank you message code box? And as value I use the field name of the checkbocgroup? And as cases the values of the checkbox group?
Tiko 11 Apr, 2014
So this is the code I put in my thank you message:
<?php

switch ($dossiers_spectacles) {
    case "arbre_a_t":
        echo "<a href=\'http://www.reve2.com/MyJoomla/joomla_docs/dossier_arbre_a_t.pdf\' target=\'_blank\'>Dossier de \L'arbre à T</a>";
    case "essenciel":
        echo "<a href=\'http://www.reve2.com/MyJoomla/joomla_docs/dossier_essenciel_19_09_2013.pdf\' target=\'_blank\'>Dossier de L'essenciel</a>";
    case "blind_date":
        echo "<a href=\'http://www.reve2.com/MyJoomla/joomla_docs/dossier_essenciel_19_09_2013.pdf\' target=\'_blank\'>Dossier de Blind Date</a>";
     case "hybride":
        echo "<a href=\'http://www.reve2.com/MyJoomla/joomla_docs/dossier_essenciel_19_09_2013.pdf\' target=\'_blank\'>Dossier de Hybride</a>";
      case "incubes":
        echo "<a href=\'http://www.reve2.com/MyJoomla/joomla_docs/dossier_essenciel_19_09_2013.pdf\' target=\'_blank\'>Dossier de Les Incubés</a>";
        break;
}
 ?>

But in the thank you message it displays: Dossier de \L'arbre à T"; case "essenciel": echo "Dossier de L'essenciel"; case "blind_date": echo "Dossier de Blind Date"; case "hybride": echo "Dossier de Hybride"; case "incubes": echo "Dossier de Les Incubés"; break; } ?>
So, what do I do wrong?
GreyHead 17 Apr, 2014
Hi Tiko,

The Thank You Page action doesn't support PHP (not sure why). Please copy and paste the same code into a Custom Code action and then test again.

Bob
Tiko 17 Apr, 2014
Thank you for your reply. Everything is ok now thanks to our good friend Sloan who saved me.
Finally it wouldn't have worked with a switch statement apparently, but you should ask Sloan for details.
Thank you anyway,
Tiko.
This topic is locked and no more replies can be posted.