data['amt'] = 32; break; case "chicken": echo "Your meal choice is chicken!";$form->data['amt'] = 26; break; case "pork": echo "Your meal choice is pork!";$form->data['amt'] =32; break; default:echo "No Match";}?>Below is the addition php which needs to change ​$form->data['cost'] = $form->data['amt'] + $form->data['amt1'];?>"> Problem converting v5 php to v6 - Forums

Forums

Problem converting v5 php to v6

dariegler 13 May, 2019
I have the following custiom code to determine a meal choice from a dropdown i have two problems.
1. getting the value of thh meal so i can do a switch on the value.
2. i do this in two different pieces for two meals.
3. when done i need to add two valules together to get a total
4. the variables are defined as hidden variables.

<?php

$favcolor = $form->data['MealM'];

switch ($favcolor) {
case "Salmon":
echo "Your meal choice is Salmon";
$form->data['amt'] = 32;
break;
case "chicken":
echo "Your meal choice is chicken!";
$form->data['amt'] = 26;
break;
case "pork":
echo "Your meal choice is pork!";
$form->data['amt'] =32;
break;
default:
echo "No Match";
}
?>
Below is the addition php which needs to change

<?php

$form->data['cost'] = $form->data['amt'] + $form->data['amt1'];
?>

Max_admin 14 May, 2019
Answer
Any $form->data should be changed to $this->data

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