javascript 배열 form 데이터 여러개 보낼 수 있나요?

javascript 배열 form 데이터 여러개 보낼 수 있나요?

QA

javascript 배열 form 데이터 여러개 보낼 수 있나요?

본문



<form method="post" name="myform">
 
<table class="type11">
 
  <thead>
  <tr>
    <th scope="cols">회원아이디</th>
    <th scope="cols">입금자명</th>
    <th scope="cols">금액</th>
    <th scope="cols">날짜</th>
    <th scope="cols">상태</th>
    <th scope="cols"><a href='javascript:revcheck(this.form)'>전체</a></th>
  </tr>
  </thead>
 <tbody>
 
<?php 
 $conn = mysqli_connect("localhost", "test", "test" , "uksoft");
   $sql = "select * from g5_charge where status = '{$status}'";
   $result = mysqli_query($conn, $sql) or die(mysqli_error($conn));
while($row = mysqli_fetch_array($result)){
 
?>
  <tr>
  <td><?php echo $row['mb_id']; ?></td>
      <td><?php echo $row['use_name']; ?>"></td>
      <td><?php echo $row['price']; ?></td>
      <td><?php echo $row['date']; ?></td>
      <td><?php echo $row['status']; ?></td>
      <td><input type="checkbox" name="url_num" value="<?php echo $row['id'] ?>"></td>
   </tr>
<?php } ?>
 </tbody> 
 
</table>
</form>
<script type="text/javascript">
 
function revcheck(theform) {
        for( var i=0; i<document.myform.url_num.length; i++) {
            var ele = document.myform.url_num[i];
  var ele = document.myform.field_a[i];
  var ele = document.myform.field_b[i];
            if(ele.name == 'url_num')
                ele.checked = !ele.checked;
        }
 
        return;
    }
 
    //체크된 목록 승인
    function del() {
        j = 0;
        var cnt = 0;
        var a = new Array();
        var chk = document.forms.myform;
 
        for (i=0; i< chk.length; i++) {
            if(chk[i].checked) {
                j = 1;
                a[cnt] = chk[i].value;
                cnt = cnt+1;
            }
        } //end of for
 
        if (j == 0) {
            alert("목록을 체크하여 주십시요")
            return false;
        } else {
            ans = confirm("체크목록을 '승인' 합니다.")
            if(ans == true) {
            //return true;
            var acnt = a;
            document.myform.action ="/bbs/charge_ok.php?chk="+acnt;
            document.myform.target = "_self";
            document.myform.submit();
            }else {
                return false;
            } // end of ans
        } // end of if
    }
function revcheck2(theform) {
        for( var i=0; i<document.myform.url_num.length; i++) {
            var ele = document.myform.url_num[i];
            if(ele.name == 'url_num')
                ele.checked = !ele.checked;
        }
        return;
    }
 
    //체크된 목록 삭제
    function del2() {
        j = 0;
        var cnt = 0;
        var a = new Array();
        var chk = document.forms.myform;
 
        for (i=0; i< chk.length; i++) {
            if(chk[i].checked) {
                j = 1;
                a[cnt] = chk[i].value;
                cnt = cnt+1;
            }
        } //end of for
 
        if (j == 0) {
            alert("목록을 체크하여 주십시요")
            return false;
        } else {
            ans = confirm("체크목록을 '거절' 합니다.")
            if(ans == true) {
            //return true;
            var acnt = a;
            document.myform.action ="/bbs/charge_no.php?chk="+acnt;
            document.myform.target = "_self";
            document.myform.submit();
            }else {
                return false;
            } // end of ans
        } // end of if
    }
 
</script>

현재는 name="url_num" value="<?php echo $row['id'] ?>

url_num 밸류값만 document.myform.action ="/bbs/charge_no.php?chk="+acnt; 이렇게 chk 로 넘어오게 되어있는데

price,mb_id 도 /bbs/charge_no.php?chk=1,2,3&mb_id=test1,test2,test3&price=100,200,300 

이런식으로 넘기고 싶습니다

방법좀 가르쳐 주세요

 

이 질문에 댓글 쓰기 :

답변 1

<input hidden name="mb_id" value="<?php echo $row['mb_id']; ?>>

이런식으로 필요한 변수를 form 안쪽에 넣으세요

답변을 작성하시기 전에 로그인 해주세요.
전체 69
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT