After both myself and a friend searching for hours upon end, and trying numerous things we are unable to find out how to echo only the duplicate values of array_count_values result. I will break it down:
We have numerous select boxes, which build the array when sent via GET, for example:
<div class="form-group col-sm-2 mb-sm">
<select name="select[]" class="form-control">
<option value="" disabled="" selected="">Select</option>
<option value="optionOne">Option 1</option>
<option value="optionTwo">Option 2</option>
</select>
</div>
<div class="form-group col-sm-2 mb-sm">
<select name="select[]" class="form-control">
<option value="" disabled="" selected="">Select</option>
<option value="optionOne">Option 1</option>
<option value="optionTwo">Option 2</option>
</select>
</div>
<div class="form-group col-sm-2 mb-sm">
<select name="select[]" class="form-control">
<option value="" disabled="" selected="">Select</option>
<option value="optionOne">Option 1</option>
<option value="optionTwo">Option 2</option>
</select>
</div>
We are then doing the following:
if (max(array_count_values($_GET['select'])) == 2) {
$twoSelected = '2 of the selections are the same, which were (DUPLICATE SELECTION HERE)';
}
We have tried a foreach loop, but can't seem to get it to work.
Any help will be very much appreciated.
Kind Regards