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
https://forums.phpfreaks.com/topic/287665-check-box-list-in-popup-window/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.