채택완료

Jquery 에서 append 기능

추가버튼을 클릭할때마다

Jquery 에서 append 로
<input type="hidden" name="a[]" class="a" value="1" />

이렇게 추가하고 Form 전송하면

배열로 넘어와야하잖아요

그런데 전혀 넘어오질않는데 왜그런지 아시는분 계신가요?

답변 2개

채택된 답변
+20 포인트

현상에 대한 자세한 내용 이라던지, 기타 오류에 관련된 내용이 전혀 없어 자세한 답변은 힘들구

아래는 간단한 예제입니다.

Copy
<?php$a = (isset($_POST['a']) === true) ? $_POST['a'] : null;if ($a !== null) {    print('<pre>');    print_r($a);    print('</pre>');}?><script type="text/javascript" src="http://code.jquery.com/jquery.min.js"></script><script type="text/javascript">    $(function () {        $("#append").bind("click", function () {            $("#tmpl").children().clone().appendTo("#frm");        });    });</script><div id="tmpl" style="display: none;"><input type="hidden" name="a[]" class="a" value="1" /></div><form id="frm" method="post" action=""><input type="button" value="append" id="append" /><input type="submit" /></form>

전혀 안넘어온다는게 값이 아니라 배열 자체가 없는거라면 

form 바깥쪽에 <input type="hidden" name="a[]" class="a" value="1" /> 가 들어가있는게 아닌가요..?
 

답변을 작성하려면 로그인이 필요합니다.