But then my form is not shown at all...😟Can you help me please?RegardsSteffen"> Calculate with Values - Forums

Forums

Calculate with Values

sbischoff 30 May, 2014
Hi there,

I have a question about calculating with values.

I have the number of things someone want to order and I know that one of those things costs 4 $. How can I calculate the overall price to show it on the thanks page?

I tried to use a custom code element with this code:
<?php
$rechnungsbetrag = 0;
$rechnungsbetrag = {anzahl_buecher} + {anzahl_usb};
?>

<input type="hidden" id="rechnungsbetrag " name="rechnungsbetrag " title="rechnungsbetrag " value="<?php echo $rechnungsbetrag; ?>" />


But then my form is not shown at all...😟

Can you help me please?

Regards
Steffen
GreyHead 30 May, 2014
Answer
Hi Steffen,

You can't use the curly brackets syntax in PHP, you have to use PHP variables. Please try
<?php
$form->data['rechnungsbetrag'] = $form->data['anzahl_buecher'] + $form->data['anzahl_usb'];
?>
Then put {rechnungsbetrag} in the Thank you page.

Bob
sbischoff 30 May, 2014
Hi Bob,

thank you very much! You solved my problem!

Steffen
anythinganymated 25 Jul, 2014
hi iam having a similar problem testing
<?php
$form->data['message'] = $form->data['Kmat'] + $form->data['lgBx'];
echo $message;
?>

and in email template
{message} only returns a 0

any help will be greatly appreciated
Max_admin 25 Jul, 2014
it should be
echo $form->data['message'];
in your case!

Where do you add this code ? you should have it inside a "custom code" action BEFORE the "Email" action!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
anythinganymated 27 Jul, 2014
hi , so i replace strings on all variables to include the form data array, there is only one portion of the code being ignored, is there something i may do to covert this php to be compatible with cfv5? thanks in advance

here is the code being ignored

$total_pstairs = 0;

    $total_pstairs = 0;

    if($pickupstairs == '3' || $pickupstairs == '4' || $pickupstairs == '5' || $pickupstairs == '6' || $pickupstairs == '6+'){
        if($pickupstairs=='6+'){
            $pstairs = 5;
        }else{
            $pstairs = $pickupstairs-2;
        }

        $total_pstairs = ($total * 10)/100;
        $total_pstairs = $total_pstairs * $pstairs;
        
    }

    if($dropoffstairs == '3' || $dropoffstairs == '4' || $dropoffstairs == '5' || $dropoffstairs == '6' || $dropoffstairs == '6+'){
        if($dropoffstairs=='6+'){
            $dstairs = 5;
        }else{
            $dstairs = $dropoffstairs-2;
        }

        $total_dstairs = ($total * 10)/100;
        $total_dstairs = $total_dstairs * $dstairs;
       
    }

    $total_stairs = $total_pstairs + $total_dstairs;

    $total_quote = $total + $total_pstairs + $total_dstairs;
anythinganymated 27 Jul, 2014
sorry the issue is not in code i found that on these dropdown fields I am unable to use
elevator=Elevator
groundFloor=Ground Floor
1=1 Flight of Stairs
2=2 Flights of Stairs
3=3 Flights of Stairs
4=4 Flights of Stairs
5=5 Flights of Stairs
6=6 Flights of Stairs
6+=more than 6 Flights

and so i used

elevator=Elevator
groundFloor=Ground Floor
(1)=1 Flight of Stairs
(2)=2 Flights of Stairs
(3)=3 Flights of Stairs
(4)=4 Flights of Stairs
(5)=5 Flights of Stairs
(6)=6 Flights of Stairs
(6+)=more than 6 Flights

otherwise my server will crash?
Max_admin 30 Jul, 2014
Solved by email!

Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
This topic is locked and no more replies can be posted.