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>

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.