需要更改复选框到多选框php

时间:2016-11-03 15:23:34

标签: php select checkbox drop-down-menu html-select

我需要帮助将复选框转换为多选下拉PHP代码 -

<?php if ( ! is_tax( 'job_listing_type' ) && empty( $job_types ) ) : ?>
<ul class="job_types">
<?php foreach ( get_job_listing_types() as $type ) : ?>
<li><label for="job_type_<?php echo $type->slug; ?>" class="<?php echo sanitize_title( $type->name ); ?>"><input type="checkbox" name="filter_job_type[]" value="<?php echo $type->slug; ?>" <?php checked( in_array( $type->slug, $selected_job_types ), true ); ?> id="job_type_<?php echo $type->slug; ?>" /> <?php echo $type->name; ?></label></li>
<?php endforeach; ?>
</ul>
<input type="hidden" name="filter_job_type[]" value="" />
<?php elseif ( $job_types ) : ?>
<?php foreach ( $job_types as $job_type ) : ?>
<input type="hidden" name="filter_job_type[]" value="<?php echo sanitize_title( $job_type ); ?>" />
<?php endforeach; ?>
<?php endif; ?>

0 个答案:

没有答案