Closed (fixed)
Project:
Webform
Version:
6.x-3.2
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
5 Sep 2010 at 15:07 UTC
Updated:
22 Sep 2010 at 19:50 UTC
Hello!
last year I organized an Italian dinner. webform registration system. good work! but now this year, Italian food organization. but now use latest version webform. completely different system.
previous example piece of code: $ form_values ['submitted_tree'] ['inschrijvingsformulier'] ['spaghetti'] ['volwassen_bolognese'];
Now change this year:% Value [inschrijvingsformulier] [spaghetti] [volwassen_bolognese];
now can not calculate. (Php templates tpl.php)
How to solve?
<?php /* Begin sample create_mailmessage file */ ?>
Hallo %value[inschrijvingsformulier][achternaam] %value[inschrijvingsformulier][voornaam],
Bedankt om je in te schrijven voor het Spaghetti-Festijn!
Als bevestiging van je inschrijving hier nog even alle gegevens op een rijtje:
blokkeuze: %value[inschrijvingsformulier][komen][keuze_blok]
Spaghetti bolognese voor volwassen: %value[inschrijvingsformulier][spaghetti][volwassen_bolognese]
Spaghetti vegetarisch voor volwassen: %value[inschrijvingsformulier][spaghetti][volwassen_vegetarisch]
Spaghetti bolognese voor kinderen: %value[inschrijvingsformulier][spaghetti][kinderen_bolognese]
Spaghetti vegetarisch voor kinderen: %value[inschrijvingsformulier][spaghetti][kinderen_vegetarisch]
Graag dit bedrag overschrijven het rekeningnummer 068-2335595-56 met als vermelding "%value[inschrijvingsformulier][achternaam] %value[inschrijvingsformulier][voornaam] ?> + <?php
%value[inschrijvingsformulier][spaghetti][volwassen_bolognese];
%value[inschrijvingsformulier][spaghetti][volwassen_vegetarisch];
%value[inschrijvingsformulier][spaghetti][kinderen_bolognese];
%value[inschrijvingsformulier][spaghetti][kinderen_vegetarisch];
$aantalvolw;
$aantalkind;
$aantalvolw=%value[inschrijvingsformulier][spaghetti][volwassen_bolognese]+%value[inschrijvingsformulier][spaghetti][volwassen_vegetarisch];
$aantalkind=%value[inschrijvingsformulier][spaghetti][kinderen_bolognese]+%value[inschrijvingsformulier][spaghetti][kinderen_vegetarisch];
echo "volwassen $aantalvolw, kinderen $aantalkind";
?>"
<?php
%value[inschrijvingsformulier][spaghetti][volwassen_bolognese];
%value[inschrijvingsformulier][spaghetti][volwassen_vegetarisch];
%value[inschrijvingsformulier][spaghetti][kinderen_bolognese];
%value[inschrijvingsformulier][spaghetti][kinderen_vegetarisch];
$tarief1=8;
$tarief2=4;
$subtotaal1;
$subtotaal2;
$subtotaal3;
$subtotaal4;
$resultaat;
$subtotaal1=%value[inschrijvingsformulier][spaghetti][volwassen_bolognese]*$tarief1;
$subtotaal2=%value[inschrijvingsformulier][spaghetti][volwassen_vegetarisch]*$tarief1;
$subtotaal3=%value[inschrijvingsformulier][spaghetti][kinderen_bolognese]*$tarief2;
$subtotaal4=%value[inschrijvingsformulier][spaghetti][kinderen_vegetarisch]*$tarief2;
$resultaat=$subtotaal1+$subtotaal2+$subtotaal3+$subtotaal4;
echo "Het totaal bedrag is $resultaat euro!";
?>
Om de organisatie en voorbereiding optimaal te laten verlopen verzoeken wij u het overschrijven te storten tot laatste 30 September 2009.
Het festijn gaat door op onderstaand adres:
Piramime
Hendrick Consciencestraat 17
2300 Turnhout.
m.v.g.
Kedokids & JCDK-Team
Comments
Comment #1
quicksketchYou cannot do calculations based on
%valuevalues, since they are not actual PHP variables. If you need to get submission values as PHP to do your calculations, you can use the contents of the $submission variable. I suggest installing Devel module and doing a<?php dsm($submission); ?>in your webform-mail.tpl.php so you can find where all the values are stored.Comment #2
Tom Jacobs commentedthanks quicksketch for great tips devel module!
Great
Tom
Comment #3
quicksketch