我目前正在尝试将 3 个选择值放入一个字段中。我试图通过内爆值来做到这一点;但是我收到一条错误消息:
“警告:内爆()[function.implode]:传递的参数无效”
更新后的版本
<script>
function datepopulate(){
var day = document.getElementById('airdate_day').value;
var month = document.getElementById('airdate_month').value;
var year = document.getElementById('airdate_year').value;
var completedate = day+'-'+month+'-'+year;
document.getelementById('episode_airdate').value = completedate;
return true;
}
</script>
<?php
for($i=1910; $i<=2012; $i++)
$years[]=$i;
echo '<select id="airdate_year" onChange="javascript:datepopulate();" style="width:50px; float:left; margin-right:10px;">';
echo '<option value="">' . __("2012" ) . '</option>';
foreach($years as $year){
$selected = '';
echo '<option value="' . $year . '" ' . $selected . '>' . $year . '</option>';
}
echo '</select>';
for($i=1; $i<=12; $i++)
$months[]=$i;
echo '<select id="airdate_month" onChange="javascript:datepopulate();" style="width:50px; float:left; margin-right:10px;">';
echo '<option value="">' . __("0" ) . '</option>';
foreach($months as $month){
$selected = '';
echo '<option value="' . $month . '" ' . $selected . '>' . $month . '</option>';
}
echo '</select>';
for($i=1; $i<=31; $i++)
$days[]=$i;
echo '<select name="airdate_day" id="airdate_day" onChange="javascript:datepopulate();" style="width:50px; float:left; margin-right:10px;">';
echo '<option value="">' . __("10" ) . '</option>';
foreach($days as $day){
$selected = '';
echo '<option value="' . $day . '" ' . $selected . '>' . $day . '</option>';
}
echo '</select>';
?>
<input type="hidden" name="episode_airdate[]" id="episode_airdate[]" class="airdate regular-text" value="" />