I am trying to create an array that adds different variables to it if they are selected on a form via checkboxes.
IE:
FORM
[] option1 [] option2 [] option3
suppose that option1 and option 3 are checked
I have this at the start of my form processing page:
if (isset($option1))
{
$option1 = OP_ONE;
$option1_SLCT = OP_ONE;
$option = array ($option1);
}
if (isset($option2))
{
$option2 = OP_TWO;
$option2_SLCT = OP_TWO;
$option = array ($option2);
}
if (isset($option3))
{
$option3 = OP_THREE;
$option3_SLCT = OP_THREE;
$option = array ($option3);
}
Now in the above, this will set the array only to the last one selected. In this case option3 is the only value in the array. How do I add multiple variables to the $option array in the above set up?
I have tried
$option .= $option2
and
$option .+ $option2
and
$option += $option2
(This last one give me the error: Unsupported operand types...)
I need the variables as stand alone variables (the first two lines of the if statement) in other parts of the processing as well, so I cannot just set up the form to put them all in an array using <...name="option[]" value="option1"> etc.
Not sure what else to try.
Any ideas or suggestions?
Thanks
Rob