
<?php ob_start(); ?>
<!DOCTYPE html>
<html lang="en"> 

<head>
<?php   require_once 'head_link.php'; ?>

</head>

<body>
 
<?php   require_once 'header1.php'; ?> 

<?php 
	
	if(isset($_POST['btnsave']))
	{
		
		$UserId = $_POST['UserId'];
		
		$Task = $_POST['Task'];
		$Course = $_POST['Course'];
		
		$Teacher = $_POST['Teacher'];
		$Student = $_POST['Student'];
		$SMS = $_POST['SMS'];
		$Dues = $_POST['Dues'];
		$Bill = $_POST['Bill'];
		$HrAcc = $_POST['HrAcc'];
		$AdvSal = $_POST['AdvSal'];
		$Bank = $_POST['Bank'];
		
		$Expense = $_POST['Expense'];
		$Asset = $_POST['Asset'];
		$Report = $_POST['Report'];
		$Setting = $_POST['Setting'];
		
		
		
		if(empty($UserId)){
			$errMSG = "Please select an user !";
		}
		  
		
		// if no error occured, continue ....
		if(!isset($errMSG))
		{
			$stmt = $DB_con->prepare('INSERT INTO option_status (user_id,task,course,teacher,student,sms,dues,bill,hr_acc,adv_salary,bank,exp,asset,report,setting,status)
                                                			VALUES(:UserId,:Task,:Course,:Teacher,:Student,:SMS,:Dues,:Bill,:HrAcc,:AdvSal,:Bank,:Expense,:Asset,:Report,:Setting,1)');
			
			
			$stmt->bindParam(':UserId',$UserId);
			
			$stmt->bindParam(':Task',$Task);
			$stmt->bindParam(':Course',$Course);
			
			$stmt->bindParam(':Teacher',$Teacher);
			$stmt->bindParam(':Student',$Student);
			$stmt->bindParam(':SMS',$SMS);
			$stmt->bindParam(':Dues',$Dues);
			$stmt->bindParam(':Bill',$Bill);
			$stmt->bindParam(':HrAcc',$HrAcc);
			$stmt->bindParam(':AdvSal',$AdvSal);
			$stmt->bindParam(':Bank',$Bank);
			$stmt->bindParam(':Expense',$Expense);
			$stmt->bindParam(':Asset',$Asset);
			$stmt->bindParam(':Report',$Report);
			$stmt->bindParam(':Setting',$Setting);
			
			
			if($stmt->execute())
			{
				?>
              <script>
				alert('Data Successfully Add ...');
				window.location.href='option-status';
				</script>
          <?php	
			}
			else
			{
				$errMSG = "error while inserting....";
			}
		}
	}
?>

<?php  require_once 'sidebar.php'; ?>

  <main id="main" class="main">

    <div class="pagetitle">
      <h1>Access - Status Add | <span> <a href="option-status"> <i class="bi bi-table"></i> </a> </span> </h1>
       <hr>
    </div> 

    <section class="section">
      <div class="row">
	  
        <div class="col-lg-6">

          <div class="card">
            <div class="card-body">

	<?php
	if(isset($errMSG)){
			?>
            <div class="alert alert-danger">
            	<span class="glyphicon glyphicon-info-sign"></span> <strong><?php echo $errMSG; ?></strong>
            </div>
            <?php
	}
	else if(isset($successMSG)){
		?>
        <div class="alert alert-success">
              <strong><span class="glyphicon glyphicon-info-sign"></span> <?php echo $successMSG; ?></strong>
        </div>
        <?php
	}
	?>   

<form method="post" enctype="multipart/form-data" class="form-horizontal" >
	    
	<table class="table table-hover table-responsive">
	
   <tr>
    	
		<?php    
				   $pq=mysqli_query($con,"select * from user where userid='".$_SESSION['id']."'");
				   while($pqrow=mysqli_fetch_array($pq)){
				?>
        
        <input class="form-select" type="hidden" name="UserId11"  value="<?php echo $pqrow['userid']; ?>" />
		<?php }?>
    </tr>
	
  <tr>
    	<td><label class="control-label">Select Client</label></td>
       	<td><select  class="form-select chosen-select" name="UserId" id="UserId"/>
		<option value="#">Select User</option>
				      	<?php 
				      	$sql = "SELECT  userid,business_name FROM stuff where status=1 order by userid desc ";
								$result = $con->query($sql);

								while($row = $result->fetch_array()) {
									echo "<option value='".$row[0]."'>".$row[1]."</option>";
								} // while
								
				      	?>
		</select> </td>       
	</tr>	
	
	
	
	<tr>
    	<td><label class="control-label">Task Option</label></td>
       	<td>
		<select  class="form-select" name="Task" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	<tr>
    	<td><label class="control-label">Courses</label></td>
       	<td>
		<select  class="form-select" name="Course" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	<tr>
    	<td><label class="control-label">Teacher</label></td>
       	<td>
		<select  class="form-select" name="Teacher" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	<tr>
    	<td><label class="control-label">Student</label></td>
       	<td>
		<select  class="form-select" name="Student" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	<tr>
    	<td><label class="control-label">SMS</label></td>
       	<td>
		<select  class="form-select" name="SMS" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	<tr>
    	<td><label class="control-label">Dues</label></td>
       	<td>
		<select  class="form-select" name="Dues" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	<tr>
    	<td><label class="control-label">Bill</label></td>
       	<td>
		<select  class="form-select" name="Bill" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	<tr>
    	<td><label class="control-label">HrAcc</label></td>
       	<td>
		<select  class="form-select" name="HrAcc" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	
	
	<tr>
    	<td><label class="control-label">Adv Salary </label></td>
       	<td>
		<select  class="form-select" name="AdvSal" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	
	
	<tr>
    	<td><label class="control-label">Banking </label></td>
       	<td>
		<select  class="form-select" name="Bank" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	<tr>
    	<td><label class="control-label">Expense Option</label></td>
       	<td>
		<select  class="form-select" name="Expense" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	<tr>
    	<td><label class="control-label">Asset</label></td>
       	<td>
		<select  class="form-select" name="Asset" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	<tr>
    	<td><label class="control-label">Report</label></td>
       	<td>
		<select  class="form-select" name="Report" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	
	<tr>
    	<td><label class="control-label">Setting</label></td>
       	<td>
		<select  class="form-select" name="Setting" /> 
		<option value="Yes">Yes</option> 
		<option value="d-none">D-None</option>
		</select>
		</td>       
	</tr>
	    
    </table>
	
	
    <tr>
        <td colspan="2"><button type="submit" name="btnsave" class="btn btn-primary">
        <span class="glyphicon glyphicon-save"></span> &nbsp; Save
        </button>
        </td>
    </tr>
    
    
</form> 

 </div>
          </div>

        </div>
      </div>
	  
	  <?php include('../includes/footer.php');?>
	  
    </section>

  </main>
  




  <?php  require_once 'footer1.php'; ?>