Move the <select> generation to PHP instead of JS

This allows for filtering things better, reduces JS size and complexity.

Allows for easier modification of output format.