I have an admin page (created by someone else) that includes checkboxes. These are each linked to separate columns in the database, but our app requires only ONE of these options to be selected. I am not sure why they (previous developer) would not have used a dropdown list and one value/column in the database, but this is what I have to work with. How can I (or can I?) convert this into a dropdown? If not, is there a way to add validation to require at least one (and at most one) of the options to be selected?
the first param of
$this->Form->input() is the name of the input you want to create.
So here you have 4 different checkboxes with 4 different
name values inside your form which therefore will be submitted with those 4 names to Cake when you submit that form.
Usually in Cake you will have 1 input field per column, so in your case the first thing I would check is if you have 4 columns in your table which are called
Regarding generating a dropdown:
In the end you will need something like
$this->Form->select('my_new_name', [ 'surgical' => 'Surgeon', 'paediatric' => 'Physician' // etc. ]);
which will then be available in your controller via
$data = $this->getRequest()->getData('my_new_name');
That gives me something to work with.