Your IP : 3.143.237.203


Current Path : /home/lentoinv/churchmr.com/user/
Upload File :
Current File : //home/lentoinv/churchmr.com/user/updatemember.php

<?php     session_start(); ob_start();
		error_reporting(0); 
	@ini_set('display_error', 0);    include("../cludes/connect.inc.php");
	
	$page = 16;
	



$id = isset($_GET['index']) ? $_GET['index'] : '';


if(array_key_exists('DelMember', $_POST)){ 
$db->query("INSERT INTO mdatadel SELECT * FROM mdata WHERE id='$id' ");
$db->query("DELETE FROM mdata WHERE id='$id' ");
echo "<script type=\"text/javascript\">
    alert(\"Data Successfully Deleted!\");
    </script>";

}

$section = userName($id,'section');

if(array_key_exists('updAdult', $_POST)){ 


$section2 = $_POST['section'];
$surname = sanitize($_POST['surname']);
$firstname = sanitize($_POST['firstname']);
$othername = sanitize($_POST['othername']);
$familyname = sanitize($_POST['familyname']);

$phone = strlen(trim($_POST['phone']))>10 ? trim($_POST['phone']) : '';
$phone2 = strlen(trim($_POST['phone2']))>10 ? trim($_POST['phone2']) : '';

$email = sanitize($_POST['email']);
$sex = $_POST['sex'];
$birthday = $_POST['birthday'];
$marital = $_POST['marital'];

$address = addslashes(sanitize($_POST['address']));
$addressarea = addslashes(sanitize($_POST['addressarea']));

$office = addslashes(sanitize($_POST['office']));
$occupation = addslashes(sanitize($_POST['occupation']));
$academic = sanitize($_POST['academic']);
$professional = sanitize($_POST['professional']);

$worker = $_POST['chkwork'];
$leader = $worker==1 ? $_POST['leader'] : '';
$designation = $worker==1 ? $_POST['designation'] : '';
$aow = $worker==1 ? $_POST['aow'] : '';




    
$sql = $db->query("UPDATE mdata SET section='$section2',surname='$surname',firstname='$firstname',othername='$othername',familyname='$familyname',sex='$sex',birthday='$birthday',phone='$phone',phone2='$phone2',email='$email',address='$address',addressarea='$addressarea',occupation='$occupation',office='$office',marital='$marital',academic='$academic',professional='$professional',worker='$worker',leader='$leader',designation='$designation',aow='$aow',rep='$rep' WHERE id='$id' ") or die(mysqli_error());

      echo "<script type=\"text/javascript\">
    alert(\"Data Successfully Updated!\");
    </script>";




}




if(array_key_exists('updCampus', $_POST)){ 

$section2 = $_POST['section'];
$surname = sanitize($_POST['surname']);
$firstname = sanitize($_POST['firstname']);
$othername = sanitize($_POST['othername']);
$familyname = sanitize($_POST['familyname']);

$phone = strlen(trim($_POST['phone']))>10 ? trim($_POST['phone']) : '';
$phone2 = strlen(trim($_POST['phone2']))>10 ? trim($_POST['phone2']) : '';

$email = sanitize($_POST['email']);
$sex = $_POST['sex'];
$birthday = $_POST['birthday'];
$marital = $_POST['marital'];

$address = addslashes(sanitize($_POST['address']));
$addressarea = addslashes(sanitize($_POST['addressarea']));

$campus = addslashes(sanitize($_POST['campus']));
$faculty = addslashes(sanitize($_POST['faculty']));
$dept = sanitize($_POST['dept']);
$level = sanitize($_POST['level']);

$worker = $_POST['chkwork'];
$leader = $worker==1 ? $_POST['leader'] : '';
$designation = $worker==1 ? $_POST['designation'] : '';
$aow = $worker==1 ? $_POST['aow'] : '';


$sql = $db->query("UPDATE mdata SET section='$section2',surname='$surname',firstname='$firstname',othername='$othername',familyname='$familyname',sex='$sex',birthday='$birthday',phone='$phone',phone2='$phone2',email='$email',address='$address',addressarea='$addressarea',campus='$campus',faculty='$faculty',marital='$marital',dept='$dept',level='$level',worker='$worker',leader='$leader',designation='$designation',aow='$aow',rep='$rep' WHERE id='$id' ") or die(mysqli_error());
    

      echo "<script type=\"text/javascript\">
    alert(\"Data Successfully Updated!\");
    </script>";





}





if(array_key_exists('updYouth', $_POST)){ 

$section2 = $_POST['section'];
$surname = sanitize($_POST['surname']);
$firstname = sanitize($_POST['firstname']);
$othername = sanitize($_POST['othername']);
$familyname = sanitize($_POST['familyname']);

$phone = strlen(trim($_POST['phone']))>10 ? trim($_POST['phone']) : '';
$phone2 = strlen(trim($_POST['phone2']))>10 ? trim($_POST['phone2']) : '';

$email = sanitize($_POST['email']);
$sex = $_POST['sex'];
$birthday = $_POST['birthday'];
$marital = $_POST['marital'];

$address = addslashes(sanitize($_POST['address']));
$addressarea = addslashes(sanitize($_POST['addressarea']));

$student = $_POST['chkwork'];

$school = $student==1 ? addslashes(sanitize($_POST['school'])) : '';
$class = $student==1 ? $_POST['class'] : '';

$vocation = $student==0 ? addslashes(sanitize($_POST['vocation'])) : '';
$office = $student==0 ? addslashes(sanitize($_POST['office'])) : '';


$sql = $db->query("UPDATE mdata SET section='$section2',surname='$surname',firstname='$firstname',othername='$othername',familyname='$familyname',sex='$sex',birthday='$birthday',phone='$phone',phone2='$phone2',email='$email',address='$address',addressarea='$addressarea',student='$student',school='$school',class='$class',vocation='$vocation',office='$office',rep='$rep' WHERE id='$id' ") or die(mysqli_error());    


      echo "<script type=\"text/javascript\">
    alert(\"Data Successfully Updated!\");
    </script>";





}


if(array_key_exists('updChildren', $_POST)){ 

$section2 = $_POST['section'];
$surname = sanitize($_POST['surname']);
$firstname = sanitize($_POST['firstname']);
$othername = sanitize($_POST['othername']);
$familyname = sanitize($_POST['familyname']);

$phone = strlen(trim($_POST['phone']))>10 ? trim($_POST['phone']) : '';
$phone2 = strlen(trim($_POST['phone2']))>10 ? trim($_POST['phone2']) : '';

$email = sanitize($_POST['email']);
$sex = $_POST['sex'];
$birthday = $_POST['birthday'];
$marital = $_POST['marital'];

$address = addslashes(sanitize($_POST['address']));
$addressarea = addslashes(sanitize($_POST['addressarea']));

$school =  addslashes(sanitize($_POST['school'])) ;
$class =  $_POST['class'] ;



$sql = $db->query("UPDATE mdata SET section='$section2',surname='$surname',firstname='$firstname',othername='$othername',familyname='$familyname',sex='$sex',birthday='$birthday',address='$address',addressarea='$addressarea',school='$school',class='$class',rep='$rep' WHERE id='$id' ") or die(mysqli_error());    


      echo "<script type=\"text/javascript\">
    alert(\"Data Successfully Updated!\");
    </script>";





}





?>


<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Members Data</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.5 -->
    <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <!-- Ionicons -->
    <link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
    <!-- daterange picker -->
    <link rel="stylesheet" href="../plugins/daterangepicker/daterangepicker-bs3.css">
    <!-- iCheck for checkboxes and radio inputs -->
    <link rel="stylesheet" href="../plugins/iCheck/all.css">
    <!-- Bootstrap Color Picker -->
    <link rel="stylesheet" href="../plugins/colorpicker/bootstrap-colorpicker.min.css">
    <!-- Bootstrap time Picker -->
    <link rel="stylesheet" href="../plugins/timepicker/bootstrap-timepicker.min.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="../plugins/select2/select2.min.css">
    <!-- Theme style -->
    <link rel="stylesheet" href="../dist/css/AdminLTE.min.css">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
         folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="../dist/css/skins/_all-skins.min.css">


  </head>
  <body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">
<?php  require('header.php');  ?>

      <!-- Left side column. contains the logo and sidebar -->
<?php  require('sidebarx.php');  ?>
      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            Members Registration
            
          </h1>
         <ol class="breadcrumb">
            <li><i class="fa fa-dashboard"></i> Setup</li>
            <li class=""> <?php echo $ro['reg']; ?></li>
            <li class="active"><?php echo $ro['zone']; ?></li>
            <li class="active"><?php echo $ro['district']; ?></li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">  

          <div class="row">   
              
               <div class="col-md-4 col-sm-12 col-xs-12" id="profile">
           <div class="box">
                <div class="box-header">
                   
                     <h3  class="box-title">UPDATE MEMBER </h3>  
                  <p>                
                        <form method="get">
                         <b>SELECT MEMBER</b>
<select name="index" class="form-control select2"  onchange="submit()">
                         
                        
  <option selected disabled>SELECT MEMBER...</option> 
  <?php   $sql=$db->query("SELECT * FROM mdata WHERE did = '$did' ORDER BY surname ASC " )or die(mysqli_error());  
           while($row=mysqli_fetch_array($sql)){ ?>
                    
                           <option value="<?php echo $row['id'] ;  ?>" <?php if($row['id']==$id){ echo 'selected' ; } ?>><?php echo userName($row['id']) ;  ?></option>
                            <?php  }  ?>
                        </select>
                    </form>
                   
       </p>
       


                 <?php if($section == 'Adult'){ ?>
                 <form  method="post" >
 
            <p><i>Section</i>
              <select name="section" class="form-control"  style = "color:blue; font-weight:bold" >
            
                           <option <?php if('Adult'==$section){ echo 'selected' ; } ?>>Adult</option>
                          <option <?php if('Campus'==$section){ echo 'selected' ; } ?>>Campus</option>
                          <option <?php if('Youth'==$section){ echo 'selected' ; } ?>>Youth</option>  
                          <option <?php if('Children'==$section){ echo 'selected' ; } ?> >Children</option>
                        </select>
            </p>
                   
 
                 <p><i>Surname</i>
                  <input name="surname" class="form-control" placeholder="Surname*" value="<?php echo userName($id,'surname') ?>"  required >
                   </p>
                   
                    <p><i>Firstname</i>
                  <input name="firstname"  class="form-control" placeholder="First Name*"  value="<?php echo userName($id,'firstname') ?>" required>
                   </p>
                   <p><i>Other Names</i>
                  <input name="othername"  class="form-control" placeholder="Other Names"  value="<?php echo userName($id,'othername') ?>">
                   </p>

                   <p><i>Family Name</i>
                  <input name="familyname"  class="form-control" placeholder="Family Name*" value="<?php echo userName($id,'familyname') ?>" required>
                   </p>
                   <p><i>Gender</i>
                      <select name="sex" class="form-control select2" required="">
                                 <option selected><?php echo userName($id,'sex') ?></option> 
                                  <option>Male</option>
                                  <option>Female</option>
                                </select>
                              </p>

                  <p><i>Marital Status</i>
                      <select name="marital" class="form-control select2" required>
                                 <option selected><?php echo userName($id,'marital') ?></option> 
                                  <option>Single</option>
                                  <option>Married</option>
                                  <option>Widowed</option>
                                </select>
                              </p>
                  <p><i>Date of Birth</i>
                  <input name="birthday" type="date"  class="form-control" placeholder="Date of Birth*" value="<?php echo userName($id,'birthday') ?>" required >
                   </p>
                   
                   <p><i>Phone Number (CUG)</i>
                  <input name="phone2"  class="form-control" placeholder="Phone Number (CUG)" value="<?php echo userName($id,'phone2') ?>" >
                   </p>
                   <p><i>Phone Number (Non CUG)</i>
                  <input name="phone"  class="form-control" placeholder="Phone Number (Non CUG)" value="<?php echo userName($id,'phone') ?>" >
                   </p>
                 
                    <p><i>Detailed Residential Address</i>
                      <textarea name="address" class="form-control" placeholder="Detailed Residential Address*" rows="2"  required><?php echo userName($id,'address') ?></textarea>
                     </p>

                     <p><i>Describe Area, Community, Bus Stop, Junction</i>
                      <textarea name="addressarea" class="form-control" placeholder="Describe Area, Community, Bus Stop, Junction" rows="2" ><?php echo userName($id,'addressarea') ?></textarea>
                     </p>
                      
                      <p><i>E-mail</i>
                  <input name="email" type="email"  class="form-control" placeholder="E-mail" value="<?php echo userName($id,'email') ?>" >
                   </p>
                   <p><i>Occupation</i>
                  <input name="occupation"  class="form-control" placeholder="Occupation" value="<?php echo userName($id,'occupation') ?>" >
                   </p>
                   <p><i>Office Address</i>
                  <input name="office"  class="form-control" placeholder="Office Address" value="<?php echo userName($id,'office') ?>" >
                   </p>
                   <p><i>Academic Qualification</i>
                  <input name="academic"  class="form-control" placeholder="Academic Qualification" value="<?php echo userName($id,'academic') ?>" >
                   </p>
                   <p><i>Professional Qualification</i>
                  <input name="professional"  class="form-control" placeholder="Professional Qualification" value="<?php echo userName($id,'professional') ?>" >
                   </p>
                    
                    
          
                               
                                
                      
                      
                      
                      
                      
                      
  
                   <script type="text/javascript">
    function ShowHideDiv() {
        var chkYes = document.getElementById("chkYes");
        var dvPassport = document.getElementById("dvPassport");
        dvPassport.style.display = chkYes.checked ? "block" : "none";    }

      function Show() {
        var kYes = document.getElementById("kYes");
        var dvPass = document.getElementById("dvPass");
        dvPass.style.display = kYes.checked ? "block" : "none";
		}
</script>
  <?php $dis = userName($id,'worker')==1 ? 'block' : 'none'; 
   $work = userName($id,'worker')==1 ? 'checked' : ''; 
    $work2 = userName($id,'worker')==0 ? 'checked' : '';

     $lead = userName($id,'leader')==1 ? 'checked' : ''; 
    $lead2 = userName($id,'leader')==0 ? 'checked' : '';  ?>
 
<p><span><strong>Church Worker?</strong></span> &nbsp;&nbsp;&nbsp; 
<label for="chkYes">
    <input type="radio" id="chkYes" name="chkwork" onclick="ShowHideDiv()" value="1" required <?php echo $work; ?> />
    Yes
</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<label for="chkNo">
    <input type="radio" id="chkNo" name="chkwork" onclick="ShowHideDiv()" value="0" required <?php echo $work2; ?> />
    No
</label>
</p>

<div id="dvPassport" style="display: <?php echo $dis ?>">
                           
<p>    <i>Designation</i>    
         <select name="designation" class="form-control select2" style="width: 100%">
 <option selected><?php echo userName($id,'designation') ?></option> 
                              
                          <?php 
							$query=$db->query("select * FROM port ORDER BY port ASC " )or die(mysqli_error());
							while($row=mysqli_fetch_array($query)){
							?>
                          <option><?php echo ucwords($row['port']); ?></option>
                          <?php }  ?>
                        </select>
                            </p>
                         <p><i>Area of Work</i>
                              <select name="aow" class="form-control select2"  style="width: 100%">
                                <option selected><?php echo userName($id,'aow') ?></option> 
                   
                          <?php 
							$query=$db->query("select * FROM aow ORDER BY aow ASC " )or die(mysqli_error());
							while($row=mysqli_fetch_array($query)){
						
							?>
                          <option><?php echo ucwords($row['aow']); ?></option>
                          <?php }  ?>
                        </select>
                        <br><em>Retreats/District Area of Work</em>
</p>     
                            <p> <b>Attends Tuesday Leaders Meeting?</b> <br><strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="leader" type="radio" value="1"  <?php echo $lead; ?> > Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="leader" type="radio" value="0"  <?php echo $lead2; ?> > No</strong></p>
  
 </div>
                
                
                   
                    
                    
                    <p>
                      
                    <button type="submit" class="btn btn-primary" name="updAdult" style="width:100%">UPDATE ADULT</button>  
                     
                    </p>
                    
                    
                    </form>  
                    <?php } ?>





                                   <?php if($section == 'Campus'){ ?>
                 <form  method="post" >
 
            
                   <p><i>Section</i>
              <select name="section" class="form-control"  style = "color:blue; font-weight:bold" >
            
                           <option <?php if('Adult'==$section){ echo 'selected' ; } ?>>Adult</option>
                          <option <?php if('Campus'==$section){ echo 'selected' ; } ?>>Campus</option>
                          <option <?php if('Youth'==$section){ echo 'selected' ; } ?>>Youth</option>  
                          <option <?php if('Children'==$section){ echo 'selected' ; } ?> >Children</option>
                        </select>
            </p>
 
                 <p><i>Surname</i>
                  <input name="surname" class="form-control" placeholder="Surname*" value="<?php echo userName($id,'surname') ?>"  required >
                   </p>
                   
                    <p><i>First Name</i>
                  <input name="firstname"  class="form-control" placeholder="First Name*" value="<?php echo userName($id,'firstname') ?>" required>
                   </p>
                   <p><i>Other Names</i>
                  <input name="othername"  class="form-control" placeholder="Other Names"  value="<?php echo userName($id,'othername') ?>" >
                   </p>

                   <p><i>Family Name</i>
                  <input name="familyname"  class="form-control" placeholder="Family Name*"  value="<?php echo userName($id,'familyname') ?>" required>
                   </p>
                   <p><i>Sex</i>
                      <select name="sex" class="form-control select2" required="">
                                 <option selected ><?php echo userName($id,'sex') ?></option> 
                                  <option>Male</option>
                                  <option>Female</option>
                                </select>
                              </p>

                  <p><i>Marital Status</i>
                      <select name="marital" class="form-control select2" required="">
                                 <option selected><?php echo userName($id,'marital') ?></option> 
                                  <option>Single</option>
                                  <option>Married</option>
                                  <option>Widowed</option>
                                </select>
                              </p>
                  <p><i>Date of Birth</i>
                  <input name="birthday" type="date"  class="form-control" placeholder="Date of Birth*" value="<?php echo userName($id,'birthday') ?>" required >
                   </p>
                   
                   <p><i>Phone Number(CUG)</i>
                  <input name="phone2"  class="form-control" placeholder="Phone Number (CUG)"  value="<?php echo userName($id,'phone2') ?>" >
                   </p>
                   <p><i>Phone Number(Non CUG)</i>
                  <input name="phone"  class="form-control" placeholder="Phone Number (Non CUG)"  value="<?php echo userName($id,'phone') ?>">
                   </p>
                 
                    <p><i>Detailed Residential Address</i>
                      <textarea name="address" class="form-control" placeholder="Detailed Residential Address*"  rows="2"  required><?php echo userName($id,'address') ?></textarea>
                     </p>

                     <p><i>Describe Area, Community, Bus Stop, Junction</i>
                      <textarea name="addressarea" class="form-control" placeholder="Describe Area, Community, Bus Stop, Junction"  rows="2" ><?php echo stripslashes(userName($id,'addressarea')) ?></textarea>
                     </p>
                      
                      <p><i>E-mail</i>
                  <input name="email" type="email"  class="form-control" placeholder="E-mail"  value="<?php echo userName($id,'email') ?>" >
                   </p>
                   <p><i>Institution/Campus</i>
                  <input name="campus"  class="form-control" placeholder="Institution/Campus"  value="<?php echo userName($id,'campus') ?>" >
                   </p>
                   <p><i>Faculty/School</i>
                  <input name="faculty"  class="form-control" placeholder="Faculty/School"  value="<?php echo userName($id,'faculty') ?>" >
                   </p>
                   <p><i>Department</i>
                  <input name="dept"  class="form-control" placeholder="Department"  value="<?php echo userName($id,'dept') ?>" >
                   </p>
                   <p><i>Level/Year</i>
                  <input name="level"  class="form-control" placeholder="Level/Year"  value="<?php echo userName($id,'level') ?>">
                   </p>
                    
                    
          
                               
                                
                      
                      
                      
                      
                      
                      
  
                   <script type="text/javascript">
    function ShowHideDiv() {
        var chkYes = document.getElementById("chkYes");
        var dvPassport = document.getElementById("dvPassport");
        dvPassport.style.display = chkYes.checked ? "block" : "none";    }

      function Show() {
        var kYes = document.getElementById("kYes");
        var dvPass = document.getElementById("dvPass");
        dvPass.style.display = kYes.checked ? "block" : "none";
    }
</script>
<?php $dis = userName($id,'worker')==1 ? 'block' : 'none'; 
   $work = userName($id,'worker')==1 ? 'checked' : ''; 
    $work2 = userName($id,'worker')==0 ? 'checked' : '';

     $lead = userName($id,'leader')==1 ? 'checked' : ''; 
    $lead2 = userName($id,'leader')==0 ? 'checked' : '';  ?>
  
 
<p><span><strong>Church Worker?</strong></span> &nbsp;&nbsp;&nbsp; 
<label for="chkYes">
    <input type="radio" id="chkYes" name="chkwork" onclick="ShowHideDiv()" value="1" required <?php echo $work; ?> />
    Yes
</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<label for="chkNo">
    <input type="radio" id="chkNo" name="chkwork" onclick="ShowHideDiv()" value="0" required <?php echo $work2; ?>  />
    No
</label>
</p>

<div id="dvPassport" style="display: <?php echo $dis; ?>">
                           
<p>        
         <select name="designation" class="form-control select2" style="width: 100%">
 <option selected disabled>DESIGNATION...</option> 
                              
                          <?php 
              $query=$db->query("select * FROM port ORDER BY port ASC " )or die(mysqli_error());
              while($row=mysqli_fetch_array($query)){
              ?>
                          <option><?php echo ucwords($row['port']); ?></option>
                          <?php }  ?>
                        </select>
                            </p>
                         <p>
                              <select name="aow" class="form-control select2"  style="width: 100%">
                                <option selected disabled>AREA OF WORK...</option> 
                   
                          <?php 
              $query=$db->query("select * FROM aow ORDER BY aow ASC " )or die(mysqli_error());
              while($row=mysqli_fetch_array($query)){
            
              ?>
                          <option><?php echo ucwords($row['aow']); ?></option>
                          <?php }  ?>
                        </select>
                        <br><em>Retreats/District Area of Work</em>
</p>     
                            <p> <b>Attends Tuesday Leaders Meeting?</b> <br><strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="leader" type="radio" value="1" <?php echo $lead; ?>> Yes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input name="leader" type="radio" value="0" <?php echo $lead2; ?>> No</strong></p>
  
 </div> <p>
                      
                    <button type="submit" class="btn btn-info" name="updCampus" style="width:100%">UPDATE CAMPUS STUDENT</button>  
                     
                    </p>
                    
                    
                    </form>  
                    <?php } ?>








                                   <?php if($section == 'Youth'){ ?>
                 <form  method="post" >
 
            
                   <p><i>Section</i>
              <select name="section" class="form-control"  style = "color:blue; font-weight:bold" >
            
                           <option <?php if('Adult'==$section){ echo 'selected' ; } ?>>Adult</option>
                          <option <?php if('Campus'==$section){ echo 'selected' ; } ?>>Campus</option>
                          <option <?php if('Youth'==$section){ echo 'selected' ; } ?>>Youth</option>  
                          <option <?php if('Children'==$section){ echo 'selected' ; } ?> >Children</option>
                        </select>
            </p> 
 
                 <p><i>Surname</i>
                  <input name="surname" class="form-control" placeholder="Surname*"  value="<?php echo userName($id,'surname') ?>" required >
                   </p>
                   
                    <p><i>First Name</i>
                  <input name="firstname"  class="form-control" placeholder="First Name*"  value="<?php echo userName($id,'firstname') ?>" required>
                   </p>
                   <p><i>Other Names</i>
                  <input name="othername"  class="form-control" placeholder="Other Names"  value="<?php echo userName($id,'othername') ?>">
                   </p>

                   <p><i>Family Name</i>
                  <input name="familyname"  class="form-control" placeholder="Family Name*"  value="<?php echo userName($id,'familyname') ?>" required>
                   </p>
                   <p><i>Sex</i>
                      <select name="sex" class="form-control select2" required="">
                                 <option selected ><?php echo userName($id,'sex') ?></option> 
                                  <option>Male</option>
                                  <option>Female</option>
                                </select>
                              </p>

                  
                  <p><i>Date of Birth</i>
                  <input name="birthday" type="date"  class="form-control" placeholder="Date of Birth*"  value="<?php echo userName($id,'birthday') ?>" required >
                   </p>
                   
                   <p><i>Phone Number(CUG)</i>
                  <input name="phone2"  class="form-control" placeholder="Phone Number (CUG)"  value="<?php echo userName($id,'phone2') ?>">
                   </p>
                   <p><i>Phone Number(Non CUG)</i>
                  <input name="phone"  class="form-control" placeholder="Phone Number (Non CUG)"  value="<?php echo userName($id,'phone') ?>">
                   </p>
                 
                    <p><i>Detailed Residential Adddress</i>
                      <textarea name="address" class="form-control" placeholder="Detailed Residential Address*"  rows="2"  required><?php echo userName($id,'address') ?></textarea>
                     </p>

                     <p><i>Describe Area, Community, Bus Stop, Junction</i>
                      <textarea name="addressarea" class="form-control" placeholder="Describe Area, Community, Bus Stop, Junction" rows="2" ><?php echo userName($id,'addressarea') ?></textarea>
                     </p>
                      
                      <p><i>E-mail</i>
                  <input name="email" type="email"  class="form-control" placeholder="E-mail"  value="<?php echo userName($id,'email') ?>" >
                   </p>
           
  
                   <script type="text/javascript">
    function ShowHideDiv() {
        var chkYes = document.getElementById("chkYes");
        var dvPassport = document.getElementById("dvPassport");
        dvPassport.style.display = chkYes.checked ? "block" : "none";  
        dvPass.style.display = chkNo.checked ? "block" : "none";    }


</script>
<?php $dis = userName($id,'student')==1 ? 'block' : 'none';
      $dis2 = userName($id,'student')==0 ? 'block' : 'none'; 
   $work = userName($id,'student')==1 ? 'checked' : ''; 
    $work2 = userName($id,'student')==0 ? 'checked' : '';
 ?>
  
 
<p><span><strong>Are you a student?</strong></span> &nbsp;&nbsp;&nbsp; 
<label for="chkYes">
    <input type="radio" id="chkYes" name="chkwork" onclick="ShowHideDiv()" value="1" required <?php echo $work; ?> />
    Student
</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<label for="chkNo">
    <input type="radio" id="chkNo" name="chkwork" onclick="ShowHideDiv()" value="0" required <?php echo $work2; ?> />
    Vocational
</label>
</p>

<div id="dvPassport" style="display: <?php echo $dis; ?>">
                           
<p><i>School</i><input name="school"  class="form-control" placeholder="School"  value="<?php echo userName($id,'school') ?>" ></p> 
<p><i>Class</i>
                      <select name="class" class="form-control select2" style="width: 100%" >
                                 <option selected><?php echo userName($id,'class') ?></option> 
                                  <option>JSS 1</option>
                                  <option>JSS 2</option>
                                  <option>JSS 3</option>
                                  <option>SSS 1</option>
                                  <option>SSS 2</option>
                                  <option>SSS 3</option>
                                  <option>EX-STUDENT</option>
                                </select>
                              </p>

  
 </div>

 <div id="dvPass" style="display: <?php echo $dis2; ?>">
                           
<p><i>Vocation</i><input name="vocation"  class="form-control" placeholder="Vocation"  value="<?php echo userName($id,'vocation') ?>" ></p> 
<p><i>Workshop Address</i><input name="office"  class="form-control" placeholder="Workshop Address"  value="<?php echo userName($id,'office') ?>"></p> 

  
 </div>


                
                
                   
                    
                    
                    <p>
                      
                    <button type="submit" class="btn btn-success" name="updYouth" style="width:100%">UPDATE  STUDENT</button>  
                     
                    </p>
                    
                    
                    </form>  
                    <?php } ?>







                                   <?php if($section == 'Children'){ ?>
                 <form  method="post" >
 
             <p><i>Section</i>
              <select name="section" class="form-control"  style = "color:blue; font-weight:bold" >
            
                           <option <?php if('Adult'==$section){ echo 'selected' ; } ?>>Adult</option>
                          <option <?php if('Campus'==$section){ echo 'selected' ; } ?>>Campus</option>
                          <option <?php if('Youth'==$section){ echo 'selected' ; } ?>>Youth</option>  
                          <option <?php if('Children'==$section){ echo 'selected' ; } ?> >Children</option>
                        </select>
            </p>
                   
 
                 <p><i>Surname</i>
                  <input name="surname" class="form-control" placeholder="Surname*"  value="<?php echo userName($id,'surname') ?>"  required >
                   </p>
                   
                    <p><i>First Name</i>
                  <input name="firstname"  class="form-control" placeholder="First Name*"  value="<?php echo userName($id,'firstname') ?>" required>
                   </p>
                   <p><i>Other Names</i>
                  <input name="othername"  class="form-control" placeholder="Other Names"  value="<?php echo userName($id,'othername') ?>">
                   </p>

                   <p><i>Family Name</i>
                  <input name="familyname"  class="form-control" placeholder="Family Name*"  value="<?php echo userName($id,'familyname') ?>" required>
                   </p>
                   <p><i>Sex</i>
                      <select name="sex" class="form-control select2" required="">
                                 <option selected><?php echo userName($id,'sex') ?></option> 
                                  <option>Male</option>
                                  <option>Female</option>
                                </select>
                              </p>

                  
                  <p><i>Date of Birth</i>
                  <input name="birthday" type="date"  class="form-control" placeholder="Date of Birth*"  value="<?php echo userName($id,'birthday') ?>" required >
                   </p> 
                 
                    <p><i>Detailed Residential Address</i>
                      <textarea name="address" class="form-control" placeholder="Detailed Residential Address*"  rows="2"  required><?php echo userName($id,'address') ?></textarea>
                     </p>

                     <p><i>Describe Area, Community, Bus Stop, Junction</i>
                      <textarea name="addressarea" class="form-control" placeholder="Describe Area, Community, Bus Stop, Junction" rows="2" ><?php echo userName($id,'addressarea') ?></textarea>
                     </p>
                      
                    
<p><i>School</i><input name="school"  class="form-control" placeholder="School"  value="<?php echo userName($id,'school') ?>"></p> 
<p><i>Class</i>
                      <select name="class" class="form-control select2" style="width: 100%" required>
                                 <option selected><?php echo userName($id,'class') ?></option> 
                                  <option>PRE NUR</option>
                                  <option>NUR</option>
                                  <option>PRY 1</option>
                                  <option>PRY 2</option>
                                  <option>PRY 3</option>
                                  <option>PRY 4</option>
                                  <option>PRY 5</option>
                                  <option>PRY 6</option>

                                  <option>JSS 1</option>
                                  <option>JSS 2</option>
                                  <option>JSS 3</option>
                                  

                                </select>
                              </p>

                    <p>
                      
                    <button type="submit" class="btn btn-warning" name="updChildren" style="width:100%">UPDATE CHILD</button>  
                     
                    </p>
                    
                    
                    </form>  
                    <?php } if(!empty($section)){ ?>
<br><br>
                 <center> <button type="button" class="btn btn-danger"  data-toggle="modal" data-target="#modal-modify"> Delete <?php echo userName($id) ;  ?></button></center> 
                  <?php } ?>
                </div><!-- /.tab-content -->
              </div><!-- /.box -->
              
               
              </div>
              
            
         
           
  
               <div class="col-md-8 col-sm-12 col-xs-12">
           <div class="box">
                 <div class="box-header">
                  <h3 class="box-title">Recent Entries</h3>
                </div><!-- /.box-header -->
                <div class="box-body table-responsive">

                
				
			
                 
                  <table  class="table table-bordered ">
                    <thead>
                         <tr>
                         
                            <th>SN</th> 
                            <th>Name</th>
                         <th>Phone (CUG)</th> 
                         <th>Phone (Other)</th>
                         <th>Gender</th>  
                         <th>Section</th>
                          </tr>
                    </thead>
                    <tbody>
 <?php $i=1; $sql=$db->query("SELECT * FROM mdata WHERE did = '$did' ORDER BY sn DESC LIMIT 10 " )or die(mysqli_error()); 
							while($row=mysqli_fetch_array($sql)){
							
							$e=$i++ ;
							?>
                          <tr class="odd gradeX">
                           <td><?php echo $e; ?></td>  
<td><a href="?index=<?php echo $row['id']; ?>"> <?php echo userName($row['id']); ?></td>
                            <td><a href="tel:<?php echo $row['phone2']; ?>"><?php echo $row['phone2']; ?></a></td>
                            <td><a href="tel:<?php echo $row['phone']; ?>"><?php echo $row['phone']; ?></a></td>
                         <td><?php echo $row['sex']; ?></td> 
                         <td><?php echo $row['section']; ?></td> 
                            
                           
                         
                          </tr>
                          <?php  } ?>
                     
                    </tbody>
                   
                  </table>
                </div><!-- /.box-body -->
              </div><!-- /.box -->
              </div>        





           
          </div><!-- /.row -->

          <!-- =========================================================== -->


          </div><!-- /.row -->

        </section> <!-- /.content -->
      </div><!-- /.content-wrapper -->

     <?php  require('footer.php');  ?>

      <!-- Control Sidebar -->
    <?php // require('settingbar.php');  ?>
      <!-- Add the sidebar's background. This div must be placed
           immediately after the control sidebar -->
      <div class="control-sidebar-bg"></div>
    </div><!-- ./wrapper -->





      <div class="modal modal-warning fade" id="modal-modify">
          <div class="modal-dialog text-center col-md-3 col-xs-12" style="text-align:left; float:none">
            <div class="modal-content">
              <div class="modal-header">
 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                  <span aria-hidden="true"> &times;</span></button>
                <h4>Delete Member from Database</h4>
              </div>
              <div class="modal-body">
        

     <i><h4>Are you sure you want to delete Delete <?php echo userName($id) ;  ?>?</h4></i><br>
                </div>
            <!-- /.modal-content -->
            <div class="modal-footer">
   <form method="post"> <button type="button" class="btn btn-outline" data-dismiss="modal" aria-label="Close">No</button> <button name="DelMember" class="btn btn-danger"  type="submit" style="float: right">Yes, Delete</button></form>
  </div>
          </div>
          <!-- /.modal-dialog -->
        </div>
      </div>


    <!-- jQuery 2.1.4 -->
   <script src="../plugins/jQuery/jQuery-2.1.4.min.js"></script>
    <!-- Bootstrap 3.3.5 -->
    <script src="../bootstrap/js/bootstrap.min.js"></script>
    <!-- Select2 -->
    <script src="../plugins/select2/select2.full.min.js"></script>
    <!-- InputMask -->
    <script src="../plugins/input-mask/jquery.inputmask.js"></script>
    <script src="../plugins/input-mask/jquery.inputmask.date.extensions.js"></script>
    <script src="../plugins/input-mask/jquery.inputmask.extensions.js"></script>
    <!-- date-range-picker -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.2/moment.min.js"></script>
    <script src="../plugins/daterangepicker/daterangepicker.js"></script>
    <!-- bootstrap color picker -->
    <script src="../plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
    <!-- bootstrap time picker -->
    <script src="../plugins/timepicker/bootstrap-timepicker.min.js"></script>
    <!-- SlimScroll 1.3.0 -->
    <script src="../plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <!-- iCheck 1.0.1 -->
    <script src="../plugins/iCheck/icheck.min.js"></script>
    <!-- FastClick -->
    <script src="../plugins/fastclick/fastclick.min.js"></script>
    <!-- AdminLTE App -->
    <script src="../dist/js/app.min.js"></script>
    <!-- AdminLTE for demo purposes -->
    <script src="../dist/js/demo.js"></script>
    <script>
      $(function () {
        //Initialize Select2 Elements
        $(".select2").select2();

        //Datemask dd/mm/yyyy
        $("#datemask").inputmask("dd/mm/yyyy", {"placeholder": "dd/mm/yyyy"});
        //Datemask2 mm/dd/yyyy
        $("#datemask2").inputmask("mm/dd/yyyy", {"placeholder": "mm/dd/yyyy"});
        //Money Euro
        $("[data-mask]").inputmask();

        //Date range picker
        $('#reservation').daterangepicker();
        //Date range picker with time picker
        $('#reservationtime').daterangepicker({timePicker: true, timePickerIncrement: 30, format: 'MM/DD/YYYY h:mm A'});
        //Date range as a button
        $('#daterange-btn').daterangepicker(
            {
              ranges: {
                'Today': [moment(), moment()],
                'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
                'Last 7 Days': [moment().subtract(6, 'days'), moment()],
                'Last 30 Days': [moment().subtract(29, 'days'), moment()],
                'This Month': [moment().startOf('month'), moment().endOf('month')],
                'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
              },
              startDate: moment().subtract(29, 'days'),
              endDate: moment()
            },
        function (start, end) {
          $('#reportrange span').html(start.format('MMMM D, YYYY') + ' - ' + end.format('MMMM D, YYYY'));
        }
        );

        //iCheck for checkbox and radio inputs
        $('input[type="checkbox"].minimal, input[type="radio"].minimal').iCheck({
          checkboxClass: 'icheckbox_minimal-blue',
          radioClass: 'iradio_minimal-blue'
        });
        //Red color scheme for iCheck
        $('input[type="checkbox"].minimal-red, input[type="radio"].minimal-red').iCheck({
          checkboxClass: 'icheckbox_minimal-red',
          radioClass: 'iradio_minimal-red'
        });
        //Flat red color scheme for iCheck
        $('input[type="checkbox"].flat-red, input[type="radio"].flat-red').iCheck({
          checkboxClass: 'icheckbox_flat-green',
          radioClass: 'iradio_flat-green'
        });

        //Colorpicker
        $(".my-colorpicker1").colorpicker();
        //color picker with addon
        $(".my-colorpicker2").colorpicker();

        //Timepicker
        $(".timepicker").timepicker({
          showInputs: false
        });
      });
	  
	  
	  
    </script>
    
    

  </body>
</html>

?>