why i dont get the check nvalue in check box?

Posted by udaya on Stack Overflow See other posts from Stack Overflow or by udaya
Published on 2010-05-21T06:29:43Z Indexed on 2010/05/21 6:30 UTC
Read the original article Hit count: 331

Filed under:
|

Hi I have a check box when check that check box the id corresponding to the check box is placed on a text box ... but when there is only single value in the database i cant get the check value why? here is my code

<? if(isset($AcceptFriend)) {?>
<form action="<?=site_url()?>friends/Accept_Friend" name="orderform" id="orderform" method="post" style="background:#CCCC99">
<input type="text" name="chId" id="chId" >
<table  border="0" height="50%" id="chkbox" width="50%" >
<tr>
<? foreach($AcceptFriend as $row)
{?>
<tr>
<td>Name</td><td><?=$row['dFrindName'].'</br>';?></td>
<td> <input type="checkbox" name="checkId" id="checkId" value="<? echo  $row['dMemberId']; ?>" onClick="get_check_value()" ></td>
</tr>

<? }}?>
</tr>
 <tr> <td width="10px"><input type="submit" name="submit" id="submit" class="buttn" value="AcceptFriend"></td></tr>

</table>


</form>

This is the script i am using

function get_check_value()
{
    var c_value = "";

    for (var i=0; i < document.orderform.checkId.length; i++)
       {
       if (document.orderform.checkId[i].checked)
          {
          c_value = c_value + document.orderform.checkId[i].value + "\n";
          }
       }
       alert(c_value);
       document.getElementById('chId').value= c_value;
}

© Stack Overflow or respective owner

Related posts about php

Related posts about checkbox