php 달력 코딩인데 무엇이 잘못되었는지 모르겠어요...

murien의 이미지

<html>
<head>
</head>
<body bgcolor="#5AC8C8" text="black">
<?
if(!$year){$year=date('Y');}
if(!$month){$month=date('m');}
if(strlen($month)==1){$month="0".$month;}

$total_date=01;
while(checkdate($month,$total_date,$year)){
$total_date++;
}
$total_date--;

echo("

<table cellpadding='0' width='350' border='1' cellspacint=0 bgcolor=#666666 bordercolordark=white bordercolorlight=black>
<tr>
<td width=350 height=40 bgcolor=#6EDCDC colspan=7>
<p align=center><b><font size=4 color=black>$(year)년 $(month)월</font></b></p>
</td>
</tr>
<tr bgcolor='white' bordercolor='white'>
<td width='50'>
<p align='center'><b><font color='red'>일</font></b></p>
</td>
<td width='50'>
<p align='center'><b>월</b></p>
</td>
<td width='50'>
<p align='center'><b>화</b></p>
</td>
<td width='50'>
<p align='center'><b>수</b></p>
</td>
<td width='50'>
<p align='center'><b>목</b></p>
</td>
<td width='50'>
<p align='center'><b>금</b></p>
</td>
<td width='50'>
<p align='center'><b>토</b></p>
</td>
</tr>
<tr>
");

$month_first_day=date(w,mktime(0,0,0,$month,$year));
$count=0;

for($i=0;$i<$month_first_day;$i++){
echo "<td width=50 height=50 bgcolor=white>&nbsp;</td>";
$count++;
}

for($i=1;$i<=total_date;$i++){
echo "<td width=50 height=50 bgcolor=white>$i</td>";
if($count==6&&($i!=$total_date)){
echo "</tr><tr>";
$count=0;
}else if($i==$total_date){
echo "</tr>";
}else{
$count++;
}

echo("
<tr>
<td width=350 height=40 bgcolor=#7DBCBE colspan=7>
<p align='right'><b><font size='3' color='black'>
<form method='post' action=$PHP_SELF name='PHP_calendar'>
<input type=text name='year' size='4' maxlength='4' value=$year >년<input type=text name='month' size='2' maxlength=2 value=$month style='width:120; height:21; background-color:#5d5d5d; border:1 dotted black;font-family:굴림; font-size:10pt;color:silver'>월
<input type=submit value='달력보기'>
</form>
</font>
</b></p>
</td>
</tr>
");
?>

</table>
</body></html>

=> 실행시켜보면..;; 86라인에서 오류난다고 그러는데...
85라인 코드거든요 -_-;;;
왜 틀린건지 모르겠어요...

kall의 이미지

for($i=1;$i<=total_date;$i++){ 

$total_date 겠죠..

편집기의 highlight 기능을 이용하시면 눈에 잘 띄겠죠...

----
자신을 이길 수 있는자는
무슨짓이든 할수있다..
즉..무서운 넘이란 말이지 ^-_-^
나? 아직 멀었지 ㅠㅠ

pir의 이미지

괄호를 빼먹었군요.

인덴트 코딩을 합시다~ ^^

<html>
<head>
</head>
<body bgcolor="#5AC8C8" text="black">
<?

if(!$year){$year=date('Y');}
if(!$month){$month=date('m');}
if(strlen($month)==1){$month="0".$month;}

$total_date=01;
while(checkdate($month,$total_date,$year)){

$total_date++;
}
$total_date--;

echo("

<table cellpadding='0' width='350' border='1' cellspacint=0 bgcolor=#666666 bordercolordark=white bordercolorlight=black>
<tr>
<td width=350 height=40 bgcolor=#6EDCDC colspan=7>
<p align=center><b><font size=4 color=black>$(year)년 $(month)월</font></b></p>
</td>
</tr>
<tr bgcolor='white' bordercolor='white'>
<td width='50'>
<p align='center'><b><font color='red'>일</font></b></p>
</td>
<td width='50'>
<p align='center'><b>월</b></p>
</td>
<td width='50'>
<p align='center'><b>화</b></p>
</td>
<td width='50'>
<p align='center'><b>수</b></p>
</td>
<td width='50'>
<p align='center'><b>목</b></p>
</td>
<td width='50'>
<p align='center'><b>금</b></p>
</td>
<td width='50'>
<p align='center'><b>토</b></p>
</td>
</tr>
<tr>
");

$month_first_day=date(w,mktime(0,0,0,$month,$year));
$count=0;

for($i=0;$i<$month_first_day;$i++){
echo "<td width=50 height=50 bgcolor=white>&nbsp;</td>";
$count++;
}

for($i=1;$i<=total_date;$i++){
echo "<td width=50 height=50 bgcolor=white>$i</td>";
if($count==6&&($i!=$total_date)){
echo "</tr><tr>";
$count=0;
}else if($i==$total_date){
echo "</tr>";
}else{
$count++;
}
}

echo("
<tr>
<td width=350 height=40 bgcolor=#7DBCBE colspan=7>
<p align='right'><b><font size='3' color='black'>
<form method='post' action=$PHP_SELF name='PHP_calendar'>
<input type=text name='year' size='4' maxlength='4' value=$year >년<input type=text name='month' size='2' maxlength=2 value=$month style='width:120; height:21; background-color:#5d5d5d; border:1 dotted black;font-family:굴림; font-size:10pt;color:silver'>월
<input type=submit value='달력보기'>
</form>
</font>
</b></p>
</td>
</tr>
");
?>

</table>
</body></html>