Can someone help me with this function code form?

Hi all!

I need advice on code, I have tested and works correctly the first show, but I hate the second function, add the two functions have if someone can advise me any recommendations would be helpful, and I'm stuck.

function Select($tax){
$terms = get_terms($tax);
$x = '<select name="'. $tax .'">';
$x .= '<option value="">Select '. ucfirst($tax) .'</option>';
foreach ($terms as $term) {
$x .= '<option value="' . $term->slug . '">' . $term->name . '</option>';
}
$x .= '</select>';
return $x;
}

This function performs correctly, when I add taxonomy fields automatically embedded in me the taxonomy selection box of the browser, but I have no clear concept for the same with checkbox, I put the incomplete function.

function checkbox($tax){
$terms = get_terms($tax);
$x = '<input type="checkbox" name="'. $tax .'">';
$x .= '<option value="">Select '. ucfirst($tax) .'</option>';
foreach ($terms as $term) {
$x .= '<option value="' . $term->slug . '">' . $term->name . '</option>';
}
$x .= '</select>';
return $x;

Thanks in advance greetings.

Paches.