foreach($books as $book) {
$bID = $book->book_id;
$bName = $book->book_name ;
$desc = $book->description;
$author = $book->author;
$publisher = $book->publisher;
$pages = $book->pages;
$pDate = $book->publication_date;
$price = $book->price;
$status = $book->status;
$quantity = $book->quantity;
$genres = $book->genres;
$reviews = $book->reviews;
};
$date = DateTime::createFromFormat("d-m-Y", $pDate);
$data = array(
'name' => 'pages',
'id' => 'pages',
'value' => $pages,
'style' => 'font-size:18px',
'size' => '35',
'placeholder' => 'Pages',
);
echo form_input($data);
echo "<br /><br />";
$months = array('' => 'Month',
'1' => 'Jan',
'2' => 'Feb',
'3' => 'Mar',
'4' => 'Apr',
'5' => 'May',
'6' => 'Jun',
'7' => 'Jul',
'8' => 'Aug',
'9' => 'Sep',
'10' => 'Oct',
'11' => 'Nov',
'12' => 'Dec'
);
$days[''] = 'Day';
for($i=1;$i<=31;$i++){
$days[$i] = $i;
}
$start_year = date("Y",mktime(0,0,0,date("m"),date("d"),date("Y")-80));
$years[''] = 'Year';
for ($i=$start_year;$i<=date("Y");++$i) {
$years[$i] = $i;
}
echo form_label('Publication Date','pDate')."<br/>".
form_dropdown('days',$days, $date->format("d"), 'required="required"'). " " . form_dropdown('months',$months, $date->format("m"), 'required="required"'). " " . form_dropdown('years',$years, $date->format("Y"), 'required="required"');
echo "<br /><br />";
我可以知道为什么我的年份部分没有显示任何价值,但是日期和月份部分显示在下拉菜单中,一切正常,除了年份部分。我怎么能解决它?