<?php include("../../include/dbconnect.php"); 

// Get all _POST VALUES HERE..

  foreach($_POST as $p=>$t)
  {
     $_POST[$p] = trim($t);
  }

  $myGroup = $_POST['Group'];

?>
<center>
<title>Accounts Group Entry</title>

<table cellpadding=0 cellspacing=4 width=590>
<tr><td style="padding:3px;" colspan=2 bgcolor="#93BEE2"><font face="Arial, Helvetica, sans-serif" ><b>Add New Accounts Group</b></font></td></tr><tr valign="top"><td colspan=2></td></tr></table>

<table border=0 cellpadding=3 cellspacing=4 width="590">

<?php

// Pull all the data from scode master & populate it

$stQuery = mysqli_query($conn,"select distinct code,description from appearin  order by description") or die(mysqli_error());


?>
  <form name='myForm01' method='POST' action='<?=$_SERVER['PHP_SELF']?>'>

	<tr>
        <td width="266"> <font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b> 
          <div align="right"><font color="#003366">The New Groupto be appeared 
            under </font></div></td><td width="300" align="left">

  <SELECT name='Group'   onChange="javascript:submit();">

<?
     echo "<option selected value=\" 0\"> Select Appear In";
    while($row = mysqli_fetch_row($stQuery))
    {

		$temp = $row[1];
        if(isset($myGroup) && preg_match("/" . preg_quote($myGroup, '/') . "/", $row[0]))
	    {
            echo "<option selected value=\"$row[0]\">$temp";
        }
        else{
            echo "<option value=\"$row[0]\">$temp";
        }
    }
?>
        </SELECT>
</td></tr>

</form>
<form name="form1" method="post" action="entry.php">
<input type="hidden" name="group" value="<?=$myGroup?>">

<? 


?>

	<tr>
	  <td > <font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b>
        <div align="right"><font color="#003366">Type </font></div></td>
	
	
	<td>
	<select name="type">
	<?php
	$result= mysqli_query($conn,"select code,description from accttype where appear_in = '$myGroup' ") or die(mysqli_error());
		  
		  while ( $row= mysqli_fetch_row($result))
		  {
			  echo "<option value='$row[0]'>";
		  echo $row[1];
		  echo "\n";
		  }
	?>
	</select>
	</td>
<tr>

          <tr> 
            
      <td align="right" width="266" bgcolor="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#003366">New 
        Group name</font></b></font></td>
            <td width="300" bgcolor="#FFFFFF"> 
              <input type="text"  size="50" onKeyPress="return event.keyCode!=13" name="headname">
            </td>
          </tr>
         
	   
          <tr> 
            <td align="right" width="266" bgcolor="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><b><font color="#003366">Maintan as Seperate Account</font></b></font></td>
            <td width="300" bgcolor="#FFFFFF"> 
<select name="groupthis">
<option value="Yes" >Yes</option>
<option value="No">No</option>
</select>            </td>
          </tr>
	            
          <tr> 
            <td colspan="2" bgcolor="#FFFFFF"> 
              <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
                <tr align="center"> 
                  <td> 
                    <input type="submit" name="accept" value="Submit">
                  </td>
                  <td> 
                    <input type="reset" name="reset" value="Clear">
                  </td>
                </tr>
              </table>
            </td>
          </tr>
          

</table>

<br><br><font size=1><center><a href= "index.html">Return to index page</center></font>
                                                                             
</body>
</html>
</center>



