질문과 답변· ··조회 9,811
에고 또 질문이요--
<?
include("./conn.php");
$tablename="cmm_board_free";
//글 불러오기
$query="select * from $tablename where NO='$NO'";
$result=mysql_query($query,$conn) or die (mysql_error());
$array=mysql_fetch_array($result);
//백슬레쉬 제거, 특수문자 변환(html용),개행(<br>) 처리 등
//$array[name]=stripslashes($array[name]);
$array[title]=stripslashes($array[title]);
$array[memo]=stripslashes($array[memo]);
$array[subject]=htmlspecialchars($array[name]);
$array[memo]=htmlspecialchars($array[memo]);
$array[memo]=nl2br($array[memo]);
?>
<html><title>C.M.M</title>
<script language="javascript">
function check_ok()
{
if(!check.title.value)
{ alert("글 제목을 입력해주세요");
check.title.focus();
return false; }
if(!check.memo.value)
{ alert("글 내용을 입력해주세요");
check.memo.focus();
return false; }
if(!check.password.value)
{ alert("비밀번호를 입력해주세요.");
check.password.focus();
return false; }
}
</script>
</head>
<form name="check" action="sujeng_ok.php" method="post" onsubmit="return check_ok();">
<input type="hidden" name=page value='<? echo $page ?>'>
<input type="hidden" name=NO value='<? echo $NO ?>'>
<table width="330" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="100">회원ID</td>
<td width="100"><input type="text" name=id size="10" maxlength="10" value='<?echo $array[member_no] ?>'></td>
</tr>
<tr >
<td width="100" >제목</td>
<td width="200"><input type="text" name=title size="35" maxlength="50" value='<? echo $array[title] ?>'></td>
</tr>
<tr>
<td width="50">내용</td>
<td width="250"><textarea type="text" name=memo rows="10" cols="30" value="<? echo $array[memo]; ?>"></textarea></td>
</tr>
<tr>
<td width="90">비밀번호</td>
<td width="250"><input type="password" name=password size="10" maxlength="10"></td>
</tr>
</table>
<table width="330" border="0" >
<tr>
<td width="110" align="right"><input type="submit" value="수정" class="insert"></td>
<td width="110" align="center"><a href= "list.php?page=<? $page ?>"><input type="submit" value="목록"></a>
</tr>
</table>
</form>
이게 제 수정 소스인데요. 강좌를 참고 해가며 만들고 있는데--;; 회원id하고 제목은 찍히는데 내용은 안나오네요. 뭐가 틀린건가요?(에고.. 귀찮게 해드려서 죄송해요)
include("./conn.php");
$tablename="cmm_board_free";
//글 불러오기
$query="select * from $tablename where NO='$NO'";
$result=mysql_query($query,$conn) or die (mysql_error());
$array=mysql_fetch_array($result);
//백슬레쉬 제거, 특수문자 변환(html용),개행(<br>) 처리 등
//$array[name]=stripslashes($array[name]);
$array[title]=stripslashes($array[title]);
$array[memo]=stripslashes($array[memo]);
$array[subject]=htmlspecialchars($array[name]);
$array[memo]=htmlspecialchars($array[memo]);
$array[memo]=nl2br($array[memo]);
?>
<html><title>C.M.M</title>
<script language="javascript">
function check_ok()
{
if(!check.title.value)
{ alert("글 제목을 입력해주세요");
check.title.focus();
return false; }
if(!check.memo.value)
{ alert("글 내용을 입력해주세요");
check.memo.focus();
return false; }
if(!check.password.value)
{ alert("비밀번호를 입력해주세요.");
check.password.focus();
return false; }
}
</script>
</head>
<form name="check" action="sujeng_ok.php" method="post" onsubmit="return check_ok();">
<input type="hidden" name=page value='<? echo $page ?>'>
<input type="hidden" name=NO value='<? echo $NO ?>'>
<table width="330" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="100">회원ID</td>
<td width="100"><input type="text" name=id size="10" maxlength="10" value='<?echo $array[member_no] ?>'></td>
</tr>
<tr >
<td width="100" >제목</td>
<td width="200"><input type="text" name=title size="35" maxlength="50" value='<? echo $array[title] ?>'></td>
</tr>
<tr>
<td width="50">내용</td>
<td width="250"><textarea type="text" name=memo rows="10" cols="30" value="<? echo $array[memo]; ?>"></textarea></td>
</tr>
<tr>
<td width="90">비밀번호</td>
<td width="250"><input type="password" name=password size="10" maxlength="10"></td>
</tr>
</table>
<table width="330" border="0" >
<tr>
<td width="110" align="right"><input type="submit" value="수정" class="insert"></td>
<td width="110" align="center"><a href= "list.php?page=<? $page ?>"><input type="submit" value="목록"></a>
</tr>
</table>
</form>
이게 제 수정 소스인데요. 강좌를 참고 해가며 만들고 있는데--;; 회원id하고 제목은 찍히는데 내용은 안나오네요. 뭐가 틀린건가요?(에고.. 귀찮게 해드려서 죄송해요)
댓글 1
<? echo "$array[memo]" ;?> 또는
<?=$array[memo]?>를
<textarea ...>요기</textarea> 사이에 넣으세요.
textarea 태그에는 기본값을 지정하는 value 옵션을 쓸 수 없습니다.
성공하시길... ^^