I have been searching for an answer to this for about an hour and can’t find what I am looking for…
I have 3 dependent select boxes on a INSERT form.(drop_1, drop_2, drop_3) Each of their values (int) represent the same field in the database called category.
I am looking for a way to choose only the highest value of the three as the value that gets inserted into the category field.
Here is what I have been trying (obviously doesn’t work):
$drop_1 = ($_POST['drop_1']);
$drop_2 = ($_POST['drop_2']);
$drop_3 = ($_POST['drop_3']);
$category = max($drop_1, $drop_2, $drop_3);
This works only if I select an option from each of the 3 boxes, but if I select an option from only 1 or 2 of the boxes the form gets submitted to the DB with blank values.
your php seems fine:
would output:
so, problem is with the form.