<?php session_start();?>
<?php require_once('open_connection.php');?>
<!--link href='blue/style.css' rel='stylesheet' type='text/css' /-->
<link href='css/imagetable.css' rel='stylesheet' type='text/css' />
<!DOCTYPE html>
<html>
<head>
       <title>PICCSB e-Directory System</title>
</head>
<body bgcolor="#333333"> 

<table width="100%" border="0" align="center">
<tr>
<td width="15%" bgcolor="#333333">&nbsp;</td>
<td width="70%" align="center" bgcolor="#FFFFFF" > 

<table width="100%" border="0" align="center">

<!-- row for header picc 1 -->
<tr>  
     <th width="100%" colspan="4"><img src="images/header-cox.jpg" width="100%" height="auto"></th>
</tr>


<!-- row for header picc 2 -->
<tr>
     <th width="100%" colspan="4"><img src="images/eoffice-cox.jpg" width="100%"  height="auto"></th>
</tr>

<!-- calling frame -->	
<tr>
    <td colspan="1" width="10%" align="center"><?php include("header.php");?></td>
	
</tr>
<tr>

<td colspan="3" width="90%" align="center" >

<tr><td align="left">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<?php
							$user_id=$_SESSION['user_id'];
							echo 'Welcome: ' . $_SESSION['user_name'];
							?>
							<a href="administrator_login.php"><img src="images/logout3.gif" align="right"></a>
							</td>
</tr>
<tr><td>
<h2 align="center">CREATE USER</h2> 
<form  method="post">
<table align="center"  class="imagetable">
 <tr>
   		 <td  align="center">Salutation</td>
    	 <td>:</td>
   		 <td><select class="span3" name="user_salutation" value="<?php echo htmlentities($_REQUEST['user_salutation']); ?>">
                                        <option></option>
                                        <option>Mr</option>
										<option>Mrs</option>
                                        <option>Ms</option>
                                    	</select>
  	</tr>
	
	 <tr>
    <td width="90" align="center">Fullname</td>
    <td >:</td>
    <td width="94"><input type="text" name="user_fullname"required class="input-xlarge" id="input01"  placeholder="user_fullname" value="<?php echo htmlentities($_REQUEST['user_fullname']); ?>"></td>
  </tr>
  <tr>
    <td width="90" align="center">Username</td>
    <td >:</td>
    <td width="94"><input type="text" name="user_name"required class="input-xlarge" id="input01"  placeholder="user_name" value="<?php echo htmlentities($_REQUEST['user_name']); ?>"></td>
  </tr>
  
  <tr>
    <td  align="center">Password</td>
    <td>:</td>
    <td><input type="password" name="user_password"required class="input-xlarge" id="input01"  placeholder="Password" value="<?php echo htmlentities($_REQUEST['user_password']); ?>"></td>
  </tr>
  <!--tr>
    <td  align="center">Section</td>
    <td>:</td>
    <td><input type="text"  name="user_section" class="input-xlarge" id="input01"  placeholder="User Section:" value="<!?php echo htmlentities($_REQUEST['user_section']); ?>"></td>
  </tr-->
   <tr>
 
                            <td align="center"><label class="control-label" for="input01">Section</label></td>
							<td>:</td>
							<td>
                              <select name="section_name" >
							  <option selected="selected">--Please Select-- </option>
							  <!--option ><!--?php echo  $row['designation_id']; ?></option-->
                                <?php 
							$section=mysql_query("select * from   tbl_ref_section order by section_name asc")or die(mysql_error());
							while($row_section=mysql_fetch_array($section)){?>
                                <option>
								<?php echo $row_section['section_name']; ?>
                                <?php } ?>
                                </option>
                              </select>
							</td>

   </tr>  
    <tr> 
    <td  align="center">UserAccess</td>  
    <td>:</td>  
    <td><select class="span2" name="user_access">   
                                        <option></option>
                                        <option>admin</option>
                                        <option>user</option>
                                    	</select>
  </tr>  
  <tr>
 
                            <td align="center"><label class="control-label" for="input01">Designation</label></td>
							<td>:</td>
							<td>
                              <select name="designation_name" >
							  <option selected="selected">--Please Select-- </option>
							  <!--option ><!--?php echo  $row['designation_id']; ?></option-->
                                <?php 
							$designation_query=mysql_query("select * from  tbl_ref_designation order by designation_name asc")or die(mysql_error());
							while($row_designation=mysql_fetch_array($designation_query)){?>
                                <option>
								<?php echo $row_designation['designation_name']; ?>
                                <?php } ?>
                                </option>
                              </select>
							</td>

   </tr>
<!--<tr><td>Assign Name</td><td> : </td><td><input type="text" size="20" maxlength="20" name="staff_assign"></td></tr>-->
<tr><td colspan="3" align="center"><input type="submit" value="INSERT" name="save" id="save" class="myButton"> 
<input type="button" class="myButton" value="USER LIST" onClick="window.location.href='administrator_user_view.php'"> 
<input type="button" class="myButton" value="ADMINISTRATOR MENU" onClick="window.location.href='administrator_menu.php'"> </td></tr>

</table>
</form>
<?php
               include('open_connection.php');
                if (isset($_POST['save'])){
 					$user_salutation=$_POST['user_salutation'];
					$user_fullname=$_POST['user_fullname'];
                    $user_name=$_POST['user_name'];
                    $user_password=$_POST['user_password'];
                    //$user_section=$_POST['user_section'];
                    $section_name=$_POST['section_name'];
                    $user_access=$_POST['user_access'];
					$designation_name=$_POST['designation_name'];
					
                    
                    mysql_query("insert into tbl_dir_user (user_salutation,user_fullname, user_name,user_password,
					section_name,user_access,designation_name )
                    values('$user_salutation','$user_fullname','$user_name','$user_password','$section_name','$user_access', '$designation_name')
                        ") or die(mysql_error());
                   echo "successful";
                }
            ?>
<!-- row for footer -->	
<tr>
	<th align="center" colspan="4">
	<img src="images/footer1.png" width="100%" height="70%">
		
	</th>
</tr>
 
<!--- end for ruang kerja 80% -->
</table>

</td>

<td width="20%" bgcolor="#333333">&nbsp;</td>

</tr>

<!--- end for ruang kerja 100% -->
</table>

</body>
</html>