I have a foreach loop that will echo out all the selection made by the user from the checkboxes.
I am trying to store the value into a variable called $getCentralArea. However, when I echo $getCentralArea it shows 4 - only the last value of the selected checked box. The correct value that I should get is 1,2,3,4.
if(!empty($_POST['centralArea']))
{
foreach($_POST['centralArea'] as $centralArea)
{
$getCentralValue = $centralArea.","; //Output will be in the following format 1,2,3,4
}
}else{ $getCentralArea="";}