<?php 


$query="SELECT usergroupID,name FROM ".$prefix."usergroup ORDER BY name ASC";


$userType=mysqli_query($linkid,$query);


?>


<div id="contentwrapper">


  <div class="main_content">


    <nav>


      <div id="jCrumbs" class="breadCrumb module">


        <ul>


          <li> <a href="#"><i class="icon-home"></i></a> </li>


          <li> <a href="#">Account Manager</a> </li>


          <li> <a href="#">User</a> </li>


        </ul>


      </div>


    </nav>


    <div class="row-fluid">


      <div class="span6">


	  <?php


		          	if(isset($_POST['submit']))


						{


						


						$name=$_POST['name'];


						$username=$_POST['username'];


						$email=$_POST['email'];


						$pass=$_POST['pass'];


						$password=base64_encode($pass);


						$usergroup=$_POST['usergroup'];


						//echo $code.$name.$prefix."Hello";				


						


						$query = "INSERT INTO ".$prefix."employee values (null,'$name','$username','$email','$password','$usergroup',$uid,CURDATE(),1)";


						$result=mysqli_query($linkid,$query) or die(mysqli_error());		


						


						if($result){


						?>


						<div class="alert alert-success">


                                <a data-dismiss="alert" class="close">x</a>


                                <strong>User </strong> is saved.


                            </div>			


						<?php 


						


						 }


						}


							


					 //unlink($filename1);


					 


						 unset($_POST);


						 $_POST['submit']='';


						 $_POST='';


					?>


        <h3 class="heading">New User </h3>


            <form class="form_validation_reg" id="form_validation_reg" action=""  method="post">


          <div class="formSep">


            <div class="row-fluid">


              <div class="span4">


                <label>Name<span class="f_req">*</span></label>


                <input type="text" name="name" id="name" class="span12" />


              </div>


              <div class="span4">


                <label>User Name   <span class="f_req">*</span></label>


                <input type="text" name="username" id="username" class="span12" />


              </div>


            </div>


          </div>


		  <div class="formSep">


            <div class="row-fluid">


              <div class="span4">


                <label>Email Address</label>


                <input type="text" name="email" id="email" class="span12" />


              </div>


              <div class="span4">


                <label>Password   <span class="f_req">*</span></label>


                <input type="password" name="pass" id="pass" class="span12" />


              </div>


            </div>


          </div>


		  <div class="formSep">


            <div class="row-fluid">


              <div class="span4">


                <label>User Group</label>


                <SELECT class="input_text" name="usergroup" id="usergroup">


                   <OPTION SELECTED VALUE="">Please select</OPTION>


                  <?php


					if($userType)


					{


					   while($mydata=mysqli_fetch_row($userType))


						{


						 echo "<option value='$mydata[0]'>$mydata[1]</option>";


						}


					}	


						?>


                </SELECT>


              </div>


             


            </div>


          </div>


          


          


          <div class="form-actions">


            <input class="btn btn-inverse" name="submit" type="submit" value="Save Form" />


            <button class="btn">Cancel</button>


          </div>


        </form>


      </div>


    </div>


  </div>


</div>


