php 초보입니다. 어떤식으로 form 대이타를 처리해야할지 몰겠습니다.
기존의 주문요청서에서 주문을 간단히 하기위해. 물품테이블에 등록한 물품명과 단위가격을 가져와
주문시 물품선택과 수량입력후 버튼클릭하면 바로 해당 가격을 보여주고싶어서 수정했습니다.
수량입력후 버튼클릭시 전체폼(fwrite)으로 받아들입니다. : 내부가격계산폼(Calcform)
아래는 해당오류 화면입니다.
위의 소스는
Copy
<?include_once("./_common.php");$i=0;$query5 = "select wr_subject, wr_3 from g4_write_prodt_list";$result5 = sql_query($query5);while($row = sql_fetch_array($result5)) { $item[$i] = $row[wr_subject]; // 상품리스트의명 $uprice[$i] = $row[wr_3]; // 해당상품의 가격 $i++;}?> <script>if ($_POST['wr_3'] && $_POST['wr_4']) { $result['CalcForm'] = $_POST['wr_3'] * $_POST['wr_4'] ; } </script><form name="fwrite" method="post" onsubmit="return fwrite_submit(this);" enctype="multipart/form-data" style="margin:0px;"><input type=hidden name=null><input type=hidden name=w value="<?=$w?>"><input type=hidden name=bo_table value="<?=$bo_table?>"><input type=hidden name=wr_id value="<?=$wr_id?>"><input type=hidden name=sca value="<?=$sca?>"><input type=hidden name=sfl value="<?=$sfl?>"><input type=hidden name=stx value="<?=$stx?>"><input type=hidden name=spt value="<?=$spt?>"><input type=hidden name=sst value="<?=$sst?>"><input type=hidden name=sod value="<?=$sod?>"><input type=hidden name=page value="<?=$page?>"><table width="<?=$width?>" align=center cellpadding=0 cellspacing=0><tr><td><tr> <td height=10></td></tr><TABLE cellSpacing=2 cellPadding=8 width="670" align=center bgColor=#ffffff><TR> <TD align=left width="15%" bgColor=#eaeaea> 회사명칭</TD> <TD width="85%" bgColor=#ffffff colSpan=3><INPUT class=ed style="WIDTH: 36%; WORD-BREAK: break-all" name=wr_1 itemname="회사명칭" required value="<?=$write['wr_1']?>"></TD></TR><? if ($is_category) { ?><tr> <td align=middle bgColor=#eaeaea>· 분류</td> <td bgColor=#ffffff colSpan=3><select name=ca_name required itemname="분류"><option value="">선택하세요<?=$category_option?></select></td></tr><tr><td height=3 colspan=2 background='<?=$board_skin_path?>/img/dot_bg2.gif'></td></tr><? } ?><TR><TD noWrap align=left width="15%" bgColor=#eaeaea> 구매자명</TD><TD width="35%" bgColor=#ffffff><INPUT class=ed style="WIDTH: 100%; WORD-BREAK: break-all" name=wr_7 itemname="구매자명" value="<?=$write['wr_7']?>"></TD><TD noWrap align=left width="15%" bgColor=#eaeaea> 전자우편</TD><TD width="35%" bgColor=#ffffff><INPUT class=ed style="WIDTH: 100%; WORD-BREAK: break-all" maxLength=40 name=wr_email email itemname="전자우편" value="<?=$email?>"></TD></TR><TR><TD align=left bgColor=#eaeaea> 도메인</TD><TD bgColor=#ffffff><INPUT class=ed style="WIDTH: 100%; WORD-BREAK: break-all" name=wr_homepage itemname="도메인" value="<?=$write['wr_homepage']?>"></TD><TD align=left bgColor=#eaeaea> 전화번호</TD><TD bgColor=#ffffff><INPUT class=ed style="WIDTH: 100%; WORD-BREAK: break-all" name=wr_6 required itemname="전화번호" value="<?=$write['wr_6']?>"></TD></TR><TR> <TD align=left bgColor=#eaeaea> Pallet 선택</TD> <TD bgColor=#ffffff><SELECT name="wr_subject" > <? for($j=0; $j < count($item) ; $j++) {?> <option value='<?=$item[$j]?>'><?=$item[$j]?></option> <? } ?> </SELECT> <a href="<?=$g4[path]?>/bbs/board.php?bo_table=prodt_list">상품종류보기</a></TD> </TR><!-- 수량 입력후 버튼? 총가격 계산보여줌.!!. --><TR><form id="CalcForm" action="<?=$_SERVER['PHP_SELF']?>" method="POST" ><TD align=left bgColor=#eaeaea>수량(MT)</TD> <TD bgColor=#ffffff><INPUT maxLength=10 id=wr_3 type="text" name=wr_3 itemname="수량" required numeric value="<?=$write['wr_3']?>"> MT<INPUT type=hidden name=wr_4 value="<?=$uprice[$j]?>"><? echo $uprice[$j]; ?><? echo $_POST['wr_3'] ; ?><? // 위에서 선택한 품목 ==>$item[$j]에 따른 단위가격 ==> $uprice[$j] 을 끌어옴... ?><input type="submit" value="Buy" style="font-family:Tahoma; font-size:8pt; color:white; line-height:150%; background-color:rgb(153,0,0); border-color:rgb(176,176,176); height:25px;" align=absmiddle /><? $price = $_POST['wr_3']*$uprice[$j] ;?></TD><TD align=left bgColor=#eaeaea>총판매 가격</td><TD bgColor=#eaeaea ><INPUT type=hidden name=wr_5 value="<?=$price?>"><INPUT id=wr_5 type="text" style="WIDTH:5%; WORD-BREAK: break-all" name=wr_5 value="<?=$view['wr_5']?>" ><!--<INPUT maxLength=10 id=wr_5 type="text" name=wr_5 itemname="총판매가격" required numeric value="<?=$view['wr_5']?>"> 원--><b><font color="RED"><?=number_format('wr_5')?></font></b> 원</td></form></TR><!----------------------------------------------------------------> <tr><td height=3 colspan=2 background='<?=$board_skin_path?>/img/dot_bg2.gif'></td><td height=3 colspan=2 background='<?=$board_skin_path?>/img/dot_bg2.gif'></td></tr><TR><TD align=left bgColor=#eaeaea> 결재선택</TD> <TD bgColor=#ffffff><SELECT name=wr_2> <OPTION value=무통장입금 <?if($write[wr_2]=='무통장입금')echo "selected";?>>무통장입금</OPTION> <!-- 카드결재시.. 보안프로그램.. 필요!!!! < 미적용 > <OPTION value=카드결재 <?if($write[wr_2]=='카드결재')echo "selected";?>>카드결재</OPTION --> </SELECT></TD><TD align=left bgColor=#eaeaea> 계좌은행</TD><TD bgColor=#ffffff><SELECT name=wr_9> <OPTION value=국민은행 <?if($write[wr_9]=='국민은행' || $write[wr_5]=='')echo "selected";?>>국민) 424001-01-183080 [예금주:박모씨]</OPTION> <OPTION value=농협 <?if($write[wr_9]=='농협')echo "selected";?>>농협) 601137-56-155327 [예금주:이모씨]</OPTION><br> </SELECT> </TD></TR><TR> <TD align=left bgColor=#eaeaea> 입금자명</TD> <TD bgColor=#ffffff><INPUT maxLength=30 name=wr_10 required itemname="입금자명" value="<?=$write['wr_10']?>"></TD> <?if ($member[mb_level] == "10" ) { ?> <TD align=left bgColor=#eaeaea>판매등록여부</TD> <TD bgColor=#ffffff><input type="radio" name="wr_8" value="" <? if($write[wr_8]=='')echo "checked"?>>미등록 <input type="radio" name="wr_8" value="c" <? if($write[wr_8]=='c')echo "checked"?>>판매등록</td> <? } ?></TR>...... <? if ($is_password) { ?><TR><TD align=middle bgColor=#eaeaea>비밀번호</TD><TD bgColor=#ffffff colSpan=3><INPUT class=ed type=password maxlength=20 size=15 name=wr_password itemname="패스워드" <?=$password_required?>> (수정/삭제시 필요합니다.)</TD></TR><? } ?><? if ($is_norobot) { ?><tr> <td align=middle bgColor=#eaeaea>· <?=$norobot_str?></td> <td bgColor=#ffffff colSpan=3><input class=ed type=input size=10 name=wr_key itemname="자동등록방지" required> * 왼쪽의 글자중 <font color="red">빨간글자만</font> 순서대로 입력하세요.</td></tr><? } ?></TABLE><TABLE width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td width="100%" height="20"></td></tr><tr> <td width="100%" align="center" valign="top"> <!-- 입력 완료!/ 취소! 버튼 --> <input type=image id="btn_submit" src="<?=$board_skin_path?>/img/btn_write.gif" border=0 accesskey='s'> <a href="./board.php?bo_table=<?=$bo_table?>"><img id="btn_list" src="<?=$board_skin_path?>/img/close.gif" border=0></a></td></tr></TABLE></td></table></FORM><script type="text/javascript" src="<?="$g4[path]/js/jquery.kcaptcha.js"?>"></script><script language="javascript"><?// 관리자라면 분류 선택에 '공지' 옵션을 추가함if ($is_admin) { echo " if (typeof(document.fwrite.ca_name) != 'undefined') { document.fwrite.ca_name.options.length += 1; document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].value = '공지'; document.fwrite.ca_name.options[document.fwrite.ca_name.options.length-1].text = '공지'; }";} ?>with (document.fwrite) { if (typeof(wr_name) != "undefined") wr_name.focus(); else if (typeof(wr_subject) != "undefined") wr_subject.focus(); else if (typeof(wr_content) != "undefined") wr_content.focus(); if (typeof(ca_name) != "undefined") if (w.value == "u") ca_name.value = "<?=$write[ca_name]?>";}function html_auto_br(obj){ if (obj.checked) { result = confirm("자동 줄바꿈을 하시겠습니까?\n\n자동 줄바꿈은 게시물 내용중 줄바뀐 곳을<br>태그로 변환하는 기능입니다."); if (result) obj.value = "html2"; else obj.value = "html1"; } else obj.value = "";}function fwrite_submit(f) { /* var s = ""; if (s = word_filter_check(f.wr_subject.value)) { alert("제목에 금지단어('"+s+"')가 포함되어있습니다"); return false; } if (s = word_filter_check(f.wr_content.value)) { alert("내용에 금지단어('"+s+"')가 포함되어있습니다"); return false; } */ if (document.getElementById('char_count')) { if (char_min > 0 || char_max > 0) { var cnt = parseInt(document.getElementById('char_count').innerHTML); if (char_min > 0 && char_min > cnt) { alert("내용은 "+char_min+"글자 이상 쓰셔야 합니다."); return false; } else if (char_max > 0 && char_max < cnt) { alert("내용은 "+char_max+"글자 이하로 쓰셔야 합니다."); return false; } } } if (document.getElementById('tx_wr_content')) { if (!ed_wr_content.outputBodyText()) { alert('내용을 입력하십시오.'); ed_wr_content.returnFalse(); return false; } } <? if ($is_dhtml_editor) echo cheditor3('wr_content'); ?> var subject = ""; var content = ""; $.ajax({ url: "<?=$board_skin_path?>/ajax.filter.php", type: "POST", data: { "subject": f.wr_subject.value, "content": f.wr_content.value }, dataType: "json", async: false, cache: false, success: function(data, text상태) { subject = data.subject; content = data.content; } }); if (subject) { alert("제목에 금지단어('"+subject+"')가 포함되어있습니다"); f.wr_subject.focus(); return false; } if (content) { alert("내용에 금지단어('"+content+"')가 포함되어있습니다"); if (typeof(ed_wr_content) != "undefined") ed_wr_content.returnFalse(); else f.wr_content.focus(); return false; } if (!check_kcaptcha(f.wr_key)) { return false; } document.getElementById('btn_submit').disabled = true; document.getElementById('btn_list').disabled = true; <? if ($g4[https_url]) echo "f.action = '$g4[https_url]/$g4[bbs]/write_requpdate.php';"; else echo "f.action = './write_requpdate.php';"; ?> return true;}</script><script type="text/javascript" src="<?="$g4[path]/js/board.js"?>"></script><script type="text/javascript"> window.onload=function() { drawFont(); } </script>
|
답변 1개 / 댓글 1개
채택된 답변
+20 포인트
커네드커네드
2014-08-18 (월) 18:16:49
폼안에 폼이 있으면 않된다고 알고있어요~
단순히 수량에 따른 총가격을 보여주고자 하시면 자바스크립트로 해결하면 될것 같아요..
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.