<?php 
ob_start();
$PageSecurity = 4;
include('includes/session.inc');
include('includes/function_lib.php');
$data='';
if($_REQUEST['num']!=''){
$data='
    <table cellpadding="0" cellspacing="0" width="100%" margin-top="0"><tr><th>Sequence Number</td><th>Approval Name</td><th>Approval By</td></tr>';
for($i=0;$i<$_REQUEST['num'];$i++)
{ 
    $k=$i+1;
     $data.='<tr class="row1"><td class="tabledata1"><input type="text" value='.$k.' name=sequence_cp['.$i.'] size="5" readonly="true"></td>
                 <td class="tabledata1"><input type="text" name="approval_name_cp['.$i.']" id="approval_name_cp_'.$i.'"></td>
                <td class="tabledata1">
                <select style="width:180px;" name="approved_by_cp['.$i.'][]" id="approved_by_cp_'.$i.'" multiple>';
     //echo "SELECT * FROM www_users WHERE companyid='".$_SESSION['ACGCompanyId']."'";
                 $UserName=DB_query("SELECT * FROM www_users WHERE companyid='".$_SESSION['ACGCompanyId']."'",$db);
                   while($UserRow=DB_fetch_array($UserName))
			{ 
                   $data.= '<option style="font-size:11px; padding:2px;" value="'.$UserRow['id'].'">'.$UserRow['realname'].'</option>';
                    }
                '</select></td>
                </tr>';
} ?>
<?php  $data.='<tr><td><input type="submit" name="cp_approval" value="Save" class="search" onclick="return chkval()"/></td></tr></table>'; 
}
echo $data;
?>