Jump to content

check box list in popup window


Vinodpv

Recommended Posts

index.php

 <tr>
            <td width="125">Access Permission</td>
            <td width="10">:</td>
            <td width="175">
          <form name="frmMain" action="" method="post">
        <input type="text" name="txtSel" id="txtSel" style="background:#DFDFFF">
        <input name="btnSelect" type="button" id="btnSelect" value="Click here ...." onClick="javascript:MM_openBrWindow('access_permission.php','pop', 'scrollbars=no,width=500,height=500,left=750')">
    </form>
</td>
          </tr>
    access_permission.php

   <script language="javascript">
function selValue()
{
    var val = '';
    for(i=1;i<=frmPopup.hdnLine.value;i++)
    {
        if(eval("frmPopup.Chk"+i+".checked")==true)
        {
            val = val + eval("frmPopup.Chk"+i+".value") + ',';
        }
    }
    window.opener.document.getElementById("txtSel").value = val;
    window.close();
}
</script>
<form id="frmPopup" action="" method="post" name="frmPopup">
            <?php
            include "db_conexn.php";
            if($_SESSION['designation'] == 'Manager') {
                $selectQuery = mysql_query("SELECT * FROM navigation");
          
 if(mysql_num_rows($selectQuery)>0){$i=0;
  echo ' <tr>';
 while($row = mysql_fetch_object($selectQuery)){$i++;?>
 <?php if(($i%2)==0){echo '</tr><tr>';}?>
  <div style="width:200px; float:left;"><input name="permission[]" type="checkbox" class="validate[minCheckbox[1]] checkbox" id="Chk<?=$i;?>" value="<?php echo $row->id;?>" ><span style="font-size:12px;"> <?php echo $row->name;?></span></div>
 <?php //if(($i%2)==0){echo ' </tr>';}
 }
 }
?>   
 <input name="hdnLine" type="hidden" value="<?=$i;?>">
  <br>
  <input name="btnSelect" type="button" value="Select" onClick="JavaScript:selValue();">
</form>
.................................................................................................................................................

Here I can select all check box value from db, Please help me to display checked check boxes for edit page

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.