다중폼
본문
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td colspan="6" height="2" class="t_box_gray"></td></tr>
<tr>
<td class="write-ground td-width">
카테고리
</td>
<td class="td_padding">
<form action="<?php echo $PHP_SELF ?>" method="post" name="selbo" id="selbo">
<input type="hidden" name="selectboard" value="<?php echo $selectboard ?>">
<input type="hidden" name="weboption" value="<?php echo $weboption ?>">
<select name="selectboard" class="write-select" onchange="document.selbo.submit();">
<option value="">선택해주세요</option>
<option value="1" <?php if($selectboard == "1"){ ?>selected<?php } ?>>제작의뢰</option>
<option value="2" <?php if($selectboard == "2"){ ?>selected<?php } ?>>Q&A</option>
<option value="3" <?php if($selectboard == "3"){ ?>selected<?php } ?>>자유게시판</option>
<option value="4" <?php if($selectboard == "4"){ ?>selected<?php } ?>>1:1 문의</option>
</select>
</form>
<?php if($selectboard == ""){ ?>
<?php }elseif($selectboard == "1"){ ?>
<form action="<?php echo $PHP_SELF ?>" method="post" name="webop" id="webop">
<input type="hidden" name="weboption" value="<?php echo $weboption ?>">
<input type="hidden" name="selectboard" value="<?php echo $selectboard ?>">
<select name="weboption" class="write-select" onchange="document.webop.submit();">
<option value="">선택해주세요</option>
<option value="11" <?php if($weboption == "11"){ ?>selected<?php } ?>>제작의뢰</option>
<option value="12" <?php if($weboption == "12"){ ?>selected<?php } ?>>부가수정</option>
<option value="13" <?php if($weboption == "13"){ ?>selected<?php } ?>>리뉴얼</option>
</select>
</form>
<?php }elseif($selectboard == "2"){ ?>
<form action="<?php echo $PHP_SELF ?>" method="post" name="webop" id="webop">
<input type="hidden" name="weboption" value="<?php echo $weboption ?>">
<input type="hidden" name="selectboard" value="<?php echo $selectboard ?>">
<select name="weboption" class="write-select" onchange="document.webop.submit();">
<option value="">선택해주세요</option>
<option value="11" <?php if($weboption == "11"){ ?>selected<?php } ?>>php/mysql</option>
<option value="12" <?php if($weboption == "12"){ ?>selected<?php } ?>>jsp/asp</option>
<option value="13" <?php if($weboption == "13"){ ?>selected<?php } ?>>html</option>
<option value="14" <?php if($weboption == "14"){ ?>selected<?php } ?>>jQuery</option>
<option value="15" <?php if($weboption == "15"){ ?>selected<?php } ?>>JavaScript</option>
<option value="16" <?php if($weboption == "16"){ ?>selected<?php } ?>>기타</option>
</select>
</form>
<?php } ?>
</tr>
<tr>
<td class="write-ground">
제목
</td>
<td class="td_padding">
<input type="text" name="web_title" class="input">
</td>
</tr>
<tr><td colspan="3" height="1" class="write-line"></td></tr>
<tr>
<td class="write-ground">
이름
</td>
<td class="td_padding">
<input type="text" name="web_name" class="input1">
</td>
</tr>
<tr><td colspan="3" height="1" class="write-line"></td></tr>
<tr>
<td class="write-ground">
비밀번호
</td>
<td class="td_padding">
<input type="password" name="web_name" class="input2">
</td>
</tr>
<tr><td colspan="3" height="1" class="write-line"></td></tr>
<tr>
<td class="write-ground">
예상금액
</td>
<td class="td_padding">
<input type="text" name="web_price" class="input2">
</td>
</tr>
<tr><td colspan="3" height="1" class="write-line"></td></tr>
<tr>
<td class="write-ground">
내용
</td>
<td class="td_padding">
<textarea name="web_content" id="<%!=ASP %>" class="textarea"></textarea>
</td>
</tr>
<tr class="write-ground">
<td colspan="6" align="center">
<button class="submit_button" onclick="aad()">
<p class="write_button_submit">
등록
</p>
</button>
</td>
</tr>
</table>
소스가 이런데요..
그 select 에다가도 전부 form 을 넣어줬는데
이제 등록을 누르면 글저장폼으로 이동해야하는데
form 을 밑에다가 써주면 select 내용은 못담아옵니다.
어떠가 폼을써줘야할까요 ㅠㅠ
!-->답변 1
흠...뭔가가 이상합니다.
== 기본적 체크사항 ==
제목,이름,비밀번호 등.. input 요소로 된부분은 form으로 안감싸져있네요.
select만을 form으로 감싼것 같은데... 이렇게 되면 제목,이름,비밀번호 등은 값이 안넘어올것 같군요.
또 혹시나 select 를 감싼 form밖에 또 form으로 감싸져있는지 체크해보시고요.
== 수정 소스 ==
<form action="<?php echo $PHP_SELF ?>" method="post" name="selbo" id="selbo">
<input type="hidden" name="selectboard" value="<?php echo $selectboard ?>">
<input type="hidden" name="weboption" value="<?php echo $weboption ?>">
<table width="950" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><td colspan="6" height="2" class="t_box_gray"></td></tr>
<tr>
<td class="write-ground td-width">
카테고리
</td>
<td class="td_padding">
<select name="selectboard" class="write-select" onchange="this.form.submit();">
<option value="">선택해주세요</option>
<option value="1" <?php if($selectboard == "1"){ ?>selected<?php } ?>>제작의뢰</option>
<option value="2" <?php if($selectboard == "2"){ ?>selected<?php } ?>>Q&A</option>
<option value="3" <?php if($selectboard == "3"){ ?>selected<?php } ?>>자유게시판</option>
<option value="4" <?php if($selectboard == "4"){ ?>selected<?php } ?>>1:1 문의</option>
</select>
<?php if($selectboard == "1"){ ?>
<select name="weboption" class="write-select" onchange="this.form.submit();">
<option value="">선택해주세요</option>
<option value="11" <?php if($weboption == "11"){ ?>selected<?php } ?>>제작의뢰</option>
<option value="12" <?php if($weboption == "12"){ ?>selected<?php } ?>>부가수정</option>
<option value="13" <?php if($weboption == "13"){ ?>selected<?php } ?>>리뉴얼</option>
</select>
<?php }elseif($selectboard == "2"){ ?>
<select name="weboption" class="write-select" onchange="this.form.submit();">
<option value="">선택해주세요</option>
<option value="11" <?php if($weboption == "11"){ ?>selected<?php } ?>>php/mysql</option>
<option value="12" <?php if($weboption == "12"){ ?>selected<?php } ?>>jsp/asp</option>
<option value="13" <?php if($weboption == "13"){ ?>selected<?php } ?>>html</option>
<option value="14" <?php if($weboption == "14"){ ?>selected<?php } ?>>jQuery</option>
<option value="15" <?php if($weboption == "15"){ ?>selected<?php } ?>>JavaScript</option>
<option value="16" <?php if($weboption == "16"){ ?>selected<?php } ?>>기타</option>
</select>
<?php } ?>
</tr>
<tr>
<td class="write-ground">
제목
</td>
<td class="td_padding">
<input type="text" name="web_title" class="input">
</td>
</tr>
<tr><td colspan="3" height="1" class="write-line"></td></tr>
<tr>
<td class="write-ground">
이름
</td>
<td class="td_padding">
<input type="text" name="web_name" class="input1">
</td>
</tr>
<tr><td colspan="3" height="1" class="write-line"></td></tr>
<tr>
<td class="write-ground">
비밀번호
</td>
<td class="td_padding">
<input type="password" name="web_name" class="input2">
</td>
</tr>
<tr><td colspan="3" height="1" class="write-line"></td></tr>
<tr>
<td class="write-ground">
예상금액
</td>
<td class="td_padding">
<input type="text" name="web_price" class="input2">
</td>
</tr>
<tr><td colspan="3" height="1" class="write-line"></td></tr>
<tr>
<td class="write-ground">
내용
</td>
<td class="td_padding">
<textarea name="web_content" id="<%!=ASP %>" class="textarea"></textarea>
</td>
</tr>
<tr class="write-ground">
<td colspan="6" align="center">
<button class="submit_button" onclick="aad(this.form);">
<p class="write_button_submit">
등록
</p>
</button>
</td>
</tr>
</table>
</form>
<script>
function aad(f){
f.submit();
}
</script>