생년월일을 common.lib.php로 지정해 보기
common.lib.php
// birthdate_select
function birthdate_select($date, $name="")
{
global $g4;
$s = "";
if (substr($date, 0, 4) == "0000") {
$date = $g4['time_ymdhis'];
}
preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})/", $date, $m);
// 年
$s .= "<select name='{$name}_y'>";
for ($i=$m[0]-0; $i>=$m[0]-100; $i+=-1) {
$s .= "<option value='$i'";
if ($i == $m[0]) {
$s .= " selected";
}
$s .= ">$i";
}
$s .= "</select>年 \n";
// 月
$s .= "<select name='{$name}_m'>";
for ($i=1; $i<=12; $i++) {
$s .= "<option value='$i'";
if ($i == $m[2]) {
$s .= " selected";
}
$s .= ">$i";
}
$s .= "</select>月 \n";
// 日
$s .= "<select name='{$name}_d'>";
for ($i=1; $i<=31; $i++) {
$s .= "<option value='$i'";
if ($i == $m[3]) {
$s .= " selected";
}
$s .= ">$i";
}
$s .= "</select>日 \n";
return $s;
}
이렇게 삽입하시고
<?
list($wr_4_y, $wr_4_m, $wr_4_d) = explode("-", $write['wr_4']);
?>
<?php echo birthdate_select($g4['time_ymdhis'], "wr_4");?>
이런식으로 사용하시면 됩니다..
// birthdate_select
function birthdate_select($date, $name="")
{
global $g4;
$s = "";
if (substr($date, 0, 4) == "0000") {
$date = $g4['time_ymdhis'];
}
preg_match("/([0-9]{4})-([0-9]{2})-([0-9]{2})/", $date, $m);
// 年
$s .= "<select name='{$name}_y'>";
for ($i=$m[0]-0; $i>=$m[0]-100; $i+=-1) {
$s .= "<option value='$i'";
if ($i == $m[0]) {
$s .= " selected";
}
$s .= ">$i";
}
$s .= "</select>年 \n";
// 月
$s .= "<select name='{$name}_m'>";
for ($i=1; $i<=12; $i++) {
$s .= "<option value='$i'";
if ($i == $m[2]) {
$s .= " selected";
}
$s .= ">$i";
}
$s .= "</select>月 \n";
// 日
$s .= "<select name='{$name}_d'>";
for ($i=1; $i<=31; $i++) {
$s .= "<option value='$i'";
if ($i == $m[3]) {
$s .= " selected";
}
$s .= ">$i";
}
$s .= "</select>日 \n";
return $s;
}
이렇게 삽입하시고
<?
list($wr_4_y, $wr_4_m, $wr_4_d) = explode("-", $write['wr_4']);
?>
<?php echo birthdate_select($g4['time_ymdhis'], "wr_4");?>
이런식으로 사용하시면 됩니다..
댓글 1개
rumi717
12년 전
좋아요~
게시판 목록
그누4 팁자료실
그누보드4와 관련된 팁을 여러분들과 함께 공유하세요.
나누면 즐거움이 커집니다.
나누면 즐거움이 커집니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 9 | 20년 전 | 8013 | ||
| 8 | 20년 전 | 5881 | ||
| 7 | 20년 전 | 6333 | ||
| 6 | 20년 전 | 10667 | ||
| 5 | 20년 전 | 6301 | ||
| 4 | 20년 전 | 7726 | ||
| 3 | 20년 전 | 7460 | ||
| 2 | 20년 전 | 8825 | ||
| 1 | 20년 전 | 7950 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기