Buy Now
Sign in

Problem converting v5 php to v6

dariegler , May 13 2019, 14:42
D
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.
<?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'];
?>

admin 27
May 14 2019, 12:15 #386839
 Answer
Any $form->data should be changed to $this->data
Best regards
Max
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!