<?php
session_start();
if($_SESSION["username"]=="")
{
 	echo "You are not Logged in Please <a href='index.html'>Sign in </a> First ";
}
else
{
include 'dbc.php';
$username=$_SESSION["username"];
$current_file_name = basename($_SERVER['PHP_SELF']);
$sql = "SELECT * FROM adduser where feedisc2 = '$current_file_name' and uname = '$username'";
$result=$conn->query($sql);
$row = $result->fetch_assoc();
$status=$row['feedisc3'] ;

if ($status =="")
{
echo "You are not Authorized This Page <a href='maindashboard.php'>Back </a> ";
}
else
{
include 'dbc.php';
$userid=$_SESSION["userid"];
$sql3="Select * from addclass where user_id='$userid'";
$result1 = $conn->query($sql3);
$sql4="Select * from teacher where class_name='Teacher' and user_id='$userid'";
$result4 = $conn->query($sql4);
$sql5="Select * from teacher where class_name='Teacher' and user_id='$userid'";
$result5 = $conn->query($sql5);
$sql6="Select * from teacher where class_name='Teacher' and user_id='$userid'";
$result6 = $conn->query($sql6);
$sql7="Select * from teacher where class_name='Teacher' and user_id='$userid'";
$result7 = $conn->query($sql7);
$sql8="Select * from teacher where class_name='Teacher' and user_id='$userid'";
$result8 = $conn->query($sql8);
$sql9="Select * from teacher where class_name='Teacher' and user_id='$userid'";
$result9 = $conn->query($sql9);
$sql10="Select * from teacher where class_name='Teacher' and user_id='$userid'";
$result10 = $conn->query($sql10);
$sql11="Select * from teacher where class_name='Teacher' and user_id='$userid'";
$result11 = $conn->query($sql11);
$sql12="Select * from teacher where class_name='Teacher' and user_id='$userid'";
$result12 = $conn->query($sql12);
$sql13="Select * from teacher where class_name='Teacher' and user_id='$userid'";
$result13 = $conn->query($sql13);
?>
<!doctype html>
<!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]>         <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js" lang="en">
<!--<![endif]-->

<head>
   <?php include("includes/header.php") ?>
</head>

<body>


    <!-- Left Panel -->

    <?php include("includes/menu.php") ?><!-- /#left-panel -->

    <!-- Left Panel -->

    <!-- Right Panel -->

    <div id="right-panel" class="right-panel">

        <!-- Header-->
        <header id="header" class="header">

             <?php include("includes/headermenu.php") ?>

        </header><!-- /header -->
        <!-- Header-->

        <div class="breadcrumbs">
            <div class="col-sm-6">
                <div class="page-header float-left">
                    <div class="page-title">
                        <h1><? echo "" . $_SESSION["userid"]; ?></h1>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="page-header float-right">
                    <div class="page-title">
                        <ol class="breadcrumb text-right">
                            <li class="active"><? echo "" . $_SESSION["username"]; ?></li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>

        <div class="content mt-3">

           


          <div class="col-lg-12">
                        <div class="card">
                            <div class="card-header"><strong>Add New Subjects</strong><small> Form</small></div>
                            <div class="card-body card-block">
							<form action="Add_Subjects_Save.php" method="post" enctype="multipart/form-data" class="form-group">
							<div class="row form-group">
                                                                    <div class="col col-md-3"><label for="select" class=" form-control-label">Select Class Name</label></div>
                                                                    <div class="col-12 col-md-8">
                                                                        <select name="class_name" id="class_name" class="form-control">
                                                                            <?php
  while($user_data3=$result1->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data3['cname']; ?>"><? echo $user_data3["cname"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
                                                                    </div>
																	
                                                                </div>
																
							<div class="col-12">
                                <div class="form-group"><label for="cname" class=" form-control-label">Class Section </label><input type="text" id="cls_sec" name="cls_sec" placeholder="Section" class="form-control"></div>
								</div>
								<div class="col-6">
                                <div class="form-group"><label for="cname" class=" form-control-label">Subject Name 1</label><input type="text" id="sub1" name="sub1" placeholder="Subject Name 1" class="form-control"></div>
								</div>
								
                                                                     
                                                                    <div class="col-6"><div class="form-group"><label for="cname" class=" form-control-label">Select Teacher</label>
                                                                        <select name="tech1" id="tech1" class="form-control">
                                                                            <?php
  while($user_data4=$result4->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data4['tech_name']; ?>"><? echo $user_data4["tech_name"]; ?></option>
              <?php
  }
  ?>
                                                                        </select></div>
                                                                    </div>
                                                             
								
								<div class="col-6">
                                    <div class="form-group"><label for="mfee" class=" form-control-label">Subject Name 2</label><input type="text" id="sub2" name="sub2" placeholder="Subject Name 2" class="form-control"></div>
									</div>
									
									 <div class="col-6"><div class="form-group"><label for="cname" class=" form-control-label">Select Teacher</label>
                                                                        <select name="tech2" id="tech2" class="form-control">
                                                                            <?php
  while($user_data5=$result5->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data5['tech_name']; ?>"><? echo $user_data5["tech_name"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
																		</div>
                                                                    </div>
									
									<div class="col-6">
                                <div class="form-group"><label for="feedisc1" class=" form-control-label">Subject Name 3</label><input type="text" id="sub3" name="sub3" placeholder="Subject Name 3" class="form-control"></div>
								</div>
								
								
								<div class="col-6"><div class="form-group"><label for="cname" class=" form-control-label">Select Teacher</label>
                                                                        <select name="tech3" id="tech3" class="form-control">
                                                                            <?php
  while($user_data6=$result6->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data6['tech_name']; ?>"><? echo $user_data6["tech_name"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
																		</div>
                                                                    </div>
								
								<div class="col-6">
                                    <div class="form-group"><label for="fee1" class=" form-control-label">Subject Name 4</label><input type="text" id="sub4" name="sub4" placeholder="Subject Name 4" class="form-control"></div>
									</div>
									
									<div class="col-6"><div class="form-group"><label for="cname" class=" form-control-label">Select Teacher</label>
                                                                        <select name="tech4" id="tech4" class="form-control">
                                                                            <?php
  while($user_data7=$result7->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data7['tech_name']; ?>"><? echo $user_data7["tech_name"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
																		</div>
                                                                    </div>
									
									<div class="col-6">
                                <div class="form-group"><label for="feedisc2" class=" form-control-label">Subject Name 5</label><input type="text" id="sub5" name="sub5" placeholder="Subject Name 5" class="form-control"></div>
								</div>
								
								<div class="col-6"><div class="form-group"><label for="cname" class=" form-control-label">Select Teacher</label>
                                                                        <select name="tech5" id="tech5" class="form-control">
                                                                            <?php
  while($user_data8=$result8->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data8['tech_name']; ?>"><? echo $user_data8["tech_name"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
																		</div>
                                                                    </div>
								
								<div class="col-6">
                                    <div class="form-group"><label for="fee2" class=" form-control-label">Subject Name 6</label><input type="text" id="sub6" name="sub6" placeholder="Subject Name 6" class="form-control"></div>
									</div>
									
									<div class="col-6"><div class="form-group"><label for="cname" class=" form-control-label">Select Teacher</label>
                                                                        <select name="tech6" id="tech6" class="form-control">
                                                                            <?php
  while($user_data9=$result9->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data9['tech_name']; ?>"><? echo $user_data9["tech_name"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
																		</div>
                                                                    </div>
									
									<div class="col-6">
                                <div class="form-group"><label for="feedisc3" class=" form-control-label">Subject Name 7</label><input type="text" id="sub7" name="sub7" placeholder="Subject Name 7" class="form-control"></div>
								</div>
								
								<div class="col-6"><div class="form-group"><label for="cname" class=" form-control-label">Select Teacher</label>
                                                                        <select name="tech7" id="tech7" class="form-control">
                                                                            <?php
  while($user_data10=$result10->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data10['tech_name']; ?>"><? echo $user_data10["tech_name"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
																		</div>
                                                                    </div>
								
								<div class="col-6">
                                    <div class="form-group"><label for="fee3" class=" form-control-label">Subject Name 8</label><input type="text" id="sub8" name="sub8" placeholder="Subject Name 8" class="form-control"></div>
									</div>
									
									<div class="col-6"><div class="form-group"><label for="cname" class=" form-control-label">Select Teacher</label>
                                                                        <select name="tech8" id="tech8" class="form-control">
                                                                            <?php
  while($user_data11=$result11->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data11['tech_name']; ?>"><? echo $user_data11["tech_name"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
																		</div>
                                                                    </div>
									<div class="col-6">
                                    <div class="form-group"><label for="fee3" class=" form-control-label">Subject Name 9</label><input type="text" id="sub9" name="sub9" placeholder="Subject Name 9" class="form-control"></div>
									</div>
									
									<div class="col-6"><div class="form-group"><label for="cname" class=" form-control-label">Select Teacher</label>
                                                                        <select name="tech9" id="tech9" class="form-control">
                                                                            <?php
  while($user_data12=$result12->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data12['tech_name']; ?>"><? echo $user_data12["tech_name"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
																		</div>
                                                                    </div>
									<div class="col-6">
                                    <div class="form-group"><label for="fee3" class=" form-control-label">Subject Name 10</label><input type="text" id="sub10" name="sub10" placeholder="Subject Name 10" class="form-control"></div>
									</div>
									
									<div class="col-6"><div class="form-group"><label for="cname" class=" form-control-label">Select Teacher</label>
                                                                        <select name="tech10" id="tech10" class="form-control">
                                                                            <?php
  while($user_data13=$result13->fetch_assoc())
  {
  ?>
              <option value="<? echo $user_data13['tech_name']; ?>"><? echo $user_data13["tech_name"]; ?></option>
              <?php
  }
  ?>
                                                                        </select>
																		</div>
                                                                    </div>
									
								
				
													
                                                    </div>
													<div class="card-footer">
                                                        <button type="submit" class="btn btn-primary btn-sm">
                                                            <i class="fa fa-dot-circle-o"></i> Add Subject
                                                        </button>
                                                        <button type="reset" class="btn btn-danger btn-sm">
                                                            <i class="fa fa-ban"></i> Reset
                                                        </button>
                                                    </div>
													
													</form>
                                                </div>
                                            </div>
<div class="col-md-12">
                        <div class="card">
                            <div class="card-header">
                                <strong class="card-title">Edit Subjects</strong>
                            </div>
                            <div class="card-body">
							<?php

include 'dbc.php';


$userid=$_SESSION["userid"];
$sql = "SELECT * FROM addsubject where user_id='$userid' order by class_name";
$result=$conn->query($sql);
?>
                                <table id="bootstrap-data-table-export" class="table table-striped table-bordered">
                                    <thead>
									<?php
                                       echo "<tr>";
echo "<th > Class Name </th>";
echo "<th > Class Section </th>";
echo "<th > Subject 1 </th>";
echo "<th > Subject 2 </th>";
echo "<th > Subject 3 </th>";
echo "<th > Subject 4 </th>";
echo "<th > Subject 5 </th>";
echo "<th > Subject 6 </th>";
echo "<th > Subject 7 </th>";
echo "<th > Subject 8 </th>";
echo "<th > Subject 9 </th>";
echo "<th > Subject 10 </th>";


echo "</tr>";
?>
                                    </thead>
									
                                    <tbody>
									<?php
                                       while($row = $result->fetch_assoc())
 
  {
  $id = $row['id'];	
   echo "<tr>";
echo "<td>" .$row['class_name'] . "</td>";
echo "<td>" .$row['cls_sec'] . "</td>";
echo "<td>" .$row['sub1'] . "<br>" . $row['tech1'] . "</td>";
 echo "<td>" .$row['sub2']. "<br>" . $row['tech2'] .  "</td>";
  echo "<td>" .$row['sub3'] . "<br>" . $row['tech3'] .  "</td>";
 echo "<td>" .$row['sub4']. "<br>" . $row['tech4'] . "</td>";
 echo "<td>" .$row['sub5']. "<br>" . $row['tech5'] . "</td>";
 echo "<td>" .$row['sub6'] . "<br>" . $row['tech6'] .  "</td>";
 echo "<td>" .$row['sub7'] . "<br>" . $row['tech7'] .  "</td>";
  echo "<td>" .$row['sub8'] . "<br>" . $row['tech8'] . "</td>";
   echo "<td>" .$row['sub9'] . "<br>" . $row['tech9'] . "</td>";
    echo "<td>" .$row['sub10'] . "<br>" . $row['tech10'] . "</td>";


		 ?>
		 
		  
		 <?php
		  echo"<th> <a href ='Edit_Subject.php?id=$id'>"?><button type="button" class="btn btn-primary">  Edit </button><?php "</a>";
		  echo"<th> <a href ='Del_Subject.php?id=$id'>"?><button type="button" class="btn btn-primary">  Del </button><?php "</a>";
		   
		 
		  
	
  echo "</tr>";


  }
  ?>
                                       
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
            


        </div> <!-- .content -->
    </div><!-- /#right-panel -->

    <!-- Right Panel -->

   <?php include("includes/footermenu.php") ?>

</body>

</html>
<?php
}
}
?>