我有一张桌子,employee
在那张桌子上我有one column named birthdate
那个商店date in 2012/4/5 format
在我的 php 页面中3 drop down menu called year, month and date
谁能帮我...如何将日期提取到 3 个不同的下拉菜单中?谢谢
您可以为此使用explode functin:
<body>
<?php
$date = '2012/4/5';
$date = explode('/',$date);
?>
<select name="year">
<option value="year"><?php echo $date[0]; ?></option>
</select>
<select name="month">
<option value="month"><?php echo $date[1]; ?></option>
</select>
<select name="day">
<option value="day"><?php echo $date[2]; ?></option>
</select>
</body>
in your PHP code use split method like this:
list($y,$m,$d) = split("/",$dob); // 2012/4/5
then use $y, $m and $d value as you want.