I have a form which I have a number of checkboxes for as search criteria for cars, rather than manually insert the checkboxes I am pulling them from my database so it returns checkboxes like:-
I originally named the checkboxes a value (vehicles) but when returning the results of the selected vehicles it only returns the latest selection.
I have given my checkbox name and values my vehicleid to identify the selections but can anyone help me as to how to get all the id's selected in a built up string with comma's so something like this:-
1,2,3 (1,2,3 being the vehicle id) so I can use this string in my SQL statement.
$sql='SELECT vehicle_id, display_name FROM vehicles';
echo '<input type="checkbox" name="'.$vehiclelist.'" value="'.$vehiclelistt.'" />'.$vehiclelist.'<br/>';