묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
INPUT값 추가 후 출력관련..
2010.03.30 17:57
일단 write.php 부분에
<td><font class=t_write>I P?</font></td>
<td>
<form action="view.php" method="post">
<input type="text" name="stat" />
</form>
</td>
폼을 추가해서 입력 받은 값을 view에 입력해놓은 소스에 대입하도록 했습니다.
그리고 view.php에 적당한 위치를 잡아
<?
$ip=$_POST["stat"];
$port=6900;
$fp=@fsockopen($ip, $port);
if($fp){
echo "<font color=green><b>Server ON :-)</b></font>";
}
elseif(!$fp){
echo "<font color=red><b>Server OFF :-(</b></font>";
}
?>
라고 입력을 했습니다.
결과는 view.php에서는 출력값이 보이는것 같은데, write.php에서는 글작성 버튼이 먹통이 되버리네요.
왜그럴까요...
아래 소스는 write.php 전체 소스입니다..
<?
if($mode=="reply") $title="답글 쓰기";
elseif($mode=="modify") $title="글 수정하기";
else $title="글쓰기";
?>
<SCRIPT LANGUAGE="JavaScript">
<!--
function zb_formresize(obj) {
obj.rows += 3;
}
// -->
</SCRIPT>
<table border=0 width=<?=$width?> cellsapcing=0 cellpadding=0 style=table-layout:fixed>
<form method=post name=write action=write_ok.php onsubmit="return check_submit();" enctype=multipart/form-data>
<input type=hidden name=page value=<?=$page?>>
<input type=hidden name=id value=<?=$id?>>
<input type=hidden name=no value=<?=$no?>>
<input type=hidden name=select_arrange value=<?=$select_arrange?>>
<input type=hidden name=desc value=<?=$desc?>>
<input type=hidden name=page_num value=<?=$page_num?>>
<input type=hidden name=keyword value="<?=$keyword?>">
<input type=hidden name=category value="<?=$category?>">
<input type=hidden name=sn value="<?=$sn?>">
<input type=hidden name=ss value="<?=$ss?>">
<input type=hidden name=sc value="<?=$sc?>">
<input type=hidden name=mode value="<?=$mode?>">
<input type=hidden name=stat value="<?=$stat?>">
<col width=90 align=right></col><col width=100% style=padding-left:10></col>
<tr>
<td class='write_title' align=center colspan=2><b><?=$title?><b></td>
</tr>
<?=$hide_start?>
<tr>
<td><font class=t_write>이 름</font></td>
<td><input type=text name=name value="<?=$name?>" <?=size(20)?> maxlength=20 class=input2></td></tr>
<tr>
<td><font class=t_write>비 번</font></td>
<td><input type=password name=password <?=size(20)?> maxlength=20 class=input2></td>
</tr>
<?=$hide_end?>
<tr valign=top>
<td><font class=t_write>제 목</font></td>
<td><input type=text name=subject value="<?=$subject?>" <?=size(60)?> maxlength=200 style='width:95%;word-break:break-all;' class=input2></td>
</tr>
<tr>
<td style=padding-top:3></td>
<td class=t_write>
<?=$category_kind?>
<?=$hide_notice_start?> <input type=checkbox name=notice <?=$notice?> value=1> <font class=t_write>공지사항</font> <?=$hide_notice_end?>
<?=$hide_html_start?> <input type=checkbox name=use_html <?=$use_html?> value=1> <font class=t_write>태그사용</font> <?=$hide_html_end?>
<?=$hide_secret_start?> <input type=checkbox name=is_secret <?=$secret?> value=1><font class=t_write> 관리자랑 너만 볼 수 있도록 하려면 체크</font> <?=$hide_secret_end?>
</td>
</tr>
<tr>
<td onclick=document.write.memo.rows=document.write.memo.rows+4 style=cursor:hand><font class=t_write>내 용</font><br><font class=t_write>▼ </font></td>
<td style='padding-top:8px;padding-bottom:8px;' class='scroll4'><textarea name=memo <?=size2(90)?> rows=12 class=input2 style='overflow-y:auto; overflow-x:hidden;width:95%;word-break:break-all;padding:6 6 0 6;'><?=$memo?></textarea></td>
</tr>
<?=$hide_sitelink1_start?>
<tr>
<td><font class=t_write>I P?</font></td>
<td>
<form action="view.php" method="post">
<input type="text" name="stat" value="<?=$stat?>">
</form>
</td>
</tr>
<?=$hide_sitelink1_end?>
<?=$hide_sitelink2_start?>
<tr>
<td><font class=t_write>링크 2</font></td>
<td><input type=text name=sitelink2 value="<?=$sitelink2?>" <?=size(62)?> maxlength=200 class=input2 style='width:95%;word-break:break-all;'></td>
</tr>
<?=$hide_sitelink2_end?>
<tr>
<td> </td>
</tr>
<?=$hide_pds_start?>
<tr>
<td><font class=t_write>파일 #1</font></td>
<td class=list_eng><input type=file name=file1 <?=size(50)?> maxlength=255 class=input2 style='width:95%;word-break:break-all;'> <?=$file_name1?></td>
</tr>
<tr>
<td><font class=t_write>파일 #2</font></td>
<td class=list_eng><input type=file name=file2 <?=size(50)?> maxlength=255 class=input2 style='width:95%;word-break:break-all;'> <?=$file_name2?></td>
</tr>
<tr>
<td> </td>
<td >업로드 제한은 700KB / gif, jpg 파일만 가능</td>
</tr>
<?=$hide_pds_end?>
</table>
<table border=0 width=<?=$width?> cellsapcing=0 cellpadding=0>
<tr>
<td colspan=2>
<table border=0 cellspacing=1 cellpadding=2 width=100% height=40>
<tr>
<td align=left style='padding:0 0 0 20;'>
<?=$a_imagebox?>그림창고</a>
</td>
<td align=right style='padding:0 20 0 0;'>
<input type=submit value="작성완료" class=submit accesskey="s">
<input type=button value="취소하기" class=submit onclick=history.back()>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
페이지는
http://ragpr.dothome.co.kr/bbs/zboard.php?id=list
입니다.
<td><font class=t_write>I P?</font></td>
<td>
<form action="view.php" method="post">
<input type="text" name="stat" />
</form>
</td>
폼을 추가해서 입력 받은 값을 view에 입력해놓은 소스에 대입하도록 했습니다.
그리고 view.php에 적당한 위치를 잡아
<?
$ip=$_POST["stat"];
$port=6900;
$fp=@fsockopen($ip, $port);
if($fp){
echo "<font color=green><b>Server ON :-)</b></font>";
}
elseif(!$fp){
echo "<font color=red><b>Server OFF :-(</b></font>";
}
?>
라고 입력을 했습니다.
결과는 view.php에서는 출력값이 보이는것 같은데, write.php에서는 글작성 버튼이 먹통이 되버리네요.
왜그럴까요...
아래 소스는 write.php 전체 소스입니다..
<?
if($mode=="reply") $title="답글 쓰기";
elseif($mode=="modify") $title="글 수정하기";
else $title="글쓰기";
?>
<SCRIPT LANGUAGE="JavaScript">
<!--
function zb_formresize(obj) {
obj.rows += 3;
}
// -->
</SCRIPT>
<table border=0 width=<?=$width?> cellsapcing=0 cellpadding=0 style=table-layout:fixed>
<form method=post name=write action=write_ok.php onsubmit="return check_submit();" enctype=multipart/form-data>
<input type=hidden name=page value=<?=$page?>>
<input type=hidden name=id value=<?=$id?>>
<input type=hidden name=no value=<?=$no?>>
<input type=hidden name=select_arrange value=<?=$select_arrange?>>
<input type=hidden name=desc value=<?=$desc?>>
<input type=hidden name=page_num value=<?=$page_num?>>
<input type=hidden name=keyword value="<?=$keyword?>">
<input type=hidden name=category value="<?=$category?>">
<input type=hidden name=sn value="<?=$sn?>">
<input type=hidden name=ss value="<?=$ss?>">
<input type=hidden name=sc value="<?=$sc?>">
<input type=hidden name=mode value="<?=$mode?>">
<input type=hidden name=stat value="<?=$stat?>">
<col width=90 align=right></col><col width=100% style=padding-left:10></col>
<tr>
<td class='write_title' align=center colspan=2><b><?=$title?><b></td>
</tr>
<?=$hide_start?>
<tr>
<td><font class=t_write>이 름</font></td>
<td><input type=text name=name value="<?=$name?>" <?=size(20)?> maxlength=20 class=input2></td></tr>
<tr>
<td><font class=t_write>비 번</font></td>
<td><input type=password name=password <?=size(20)?> maxlength=20 class=input2></td>
</tr>
<?=$hide_end?>
<tr valign=top>
<td><font class=t_write>제 목</font></td>
<td><input type=text name=subject value="<?=$subject?>" <?=size(60)?> maxlength=200 style='width:95%;word-break:break-all;' class=input2></td>
</tr>
<tr>
<td style=padding-top:3></td>
<td class=t_write>
<?=$category_kind?>
<?=$hide_notice_start?> <input type=checkbox name=notice <?=$notice?> value=1> <font class=t_write>공지사항</font> <?=$hide_notice_end?>
<?=$hide_html_start?> <input type=checkbox name=use_html <?=$use_html?> value=1> <font class=t_write>태그사용</font> <?=$hide_html_end?>
<?=$hide_secret_start?> <input type=checkbox name=is_secret <?=$secret?> value=1><font class=t_write> 관리자랑 너만 볼 수 있도록 하려면 체크</font> <?=$hide_secret_end?>
</td>
</tr>
<tr>
<td onclick=document.write.memo.rows=document.write.memo.rows+4 style=cursor:hand><font class=t_write>내 용</font><br><font class=t_write>▼ </font></td>
<td style='padding-top:8px;padding-bottom:8px;' class='scroll4'><textarea name=memo <?=size2(90)?> rows=12 class=input2 style='overflow-y:auto; overflow-x:hidden;width:95%;word-break:break-all;padding:6 6 0 6;'><?=$memo?></textarea></td>
</tr>
<?=$hide_sitelink1_start?>
<tr>
<td><font class=t_write>I P?</font></td>
<td>
<form action="view.php" method="post">
<input type="text" name="stat" value="<?=$stat?>">
</form>
</td>
</tr>
<?=$hide_sitelink1_end?>
<?=$hide_sitelink2_start?>
<tr>
<td><font class=t_write>링크 2</font></td>
<td><input type=text name=sitelink2 value="<?=$sitelink2?>" <?=size(62)?> maxlength=200 class=input2 style='width:95%;word-break:break-all;'></td>
</tr>
<?=$hide_sitelink2_end?>
<tr>
<td> </td>
</tr>
<?=$hide_pds_start?>
<tr>
<td><font class=t_write>파일 #1</font></td>
<td class=list_eng><input type=file name=file1 <?=size(50)?> maxlength=255 class=input2 style='width:95%;word-break:break-all;'> <?=$file_name1?></td>
</tr>
<tr>
<td><font class=t_write>파일 #2</font></td>
<td class=list_eng><input type=file name=file2 <?=size(50)?> maxlength=255 class=input2 style='width:95%;word-break:break-all;'> <?=$file_name2?></td>
</tr>
<tr>
<td> </td>
<td >업로드 제한은 700KB / gif, jpg 파일만 가능</td>
</tr>
<?=$hide_pds_end?>
</table>
<table border=0 width=<?=$width?> cellsapcing=0 cellpadding=0>
<tr>
<td colspan=2>
<table border=0 cellspacing=1 cellpadding=2 width=100% height=40>
<tr>
<td align=left style='padding:0 0 0 20;'>
<?=$a_imagebox?>그림창고</a>
</td>
<td align=right style='padding:0 20 0 0;'>
<input type=submit value="작성완료" class=submit accesskey="s">
<input type=button value="취소하기" class=submit onclick=history.back()>
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
페이지는
http://ragpr.dothome.co.kr/bbs/zboard.php?id=list
입니다.
폼안에 또 폼이 있는데 지워보시길