Buy Now
Sign in

Problem converting v5 php to v6

dariegler , May 13 2019, 14:42
dariegler 42
May 13 2019, 14:42 #386826
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.

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

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

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

admin 27
May 14 2019, 12:15 #386839
Any $form->data should be changed to $this->data
Best regards
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!