<?php
include ('session.php');
include('connection.php');
$b=$_GET['srno'];
//echo $b;
mysqli_query($GLOBALS["___mysqli_ston"], "SET NAMES utf8");
	$my="SELECT s.Sr_No,dc.dept_name,dc.dept_id as deptid,s.description,s.sub FROM success_stories s join main_dept_category dc
					on dc.dept_id = s.dept_name
					where s.Sr_No='$b'";
	$n=mysqli_query($GLOBALS["___mysqli_ston"], $my) or die ("Query Fail:".mysqli_error($GLOBALS["___mysqli_ston"]));				
	while($rw=mysqli_fetch_assoc($n))
	{
				$srno=$rw['Sr_No'];
				$dept_name = $rw['dept_name']; 
				$dept_id	=$rw['deptid'];
				$head=$rw['description'];
				$head1=$rw['sub'];
	}
?>

<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="samarth10" >

    <title>SB Admin 2 - Bootstrap Admin Theme</title>
 
    <!-- Bootstrap Core CSS -->
            
    <link href="bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    
    <!-- MetisMenu CSS -->
    <link href="bower_components/metisMenu/dist/metisMenu.min.css" rel="stylesheet">
 
    <!-- Custom CSS -->
     <link href="dist/css/sb-admin-2.css" rel="stylesheet">
 
    <!-- Custom Fonts -->
    <link href="bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> 
   
 
 <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
 
<script src="dist/js/jquery-1.7.1.min.js"></script>
 
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<link rel="stylesheet" href="dist/css/bootstrap-datepicker.css">

<link rel="stylesheet" href="tinybox/style_tiny.css" />
<script type="text/javascript" src="tinybox/tinybox.js"></script>

<script src="dist/js/bootstrap-datepicker.js"></script>
<script src="dist/js/bootstrap-datepicker.min.js"></script>

        <script type="text/javascript" >

$(function()
{
$('#dp1').datepicker();	
	
	});
</script>

<script type="text/javascript" >
        
        
        
 
</script>

</head>

<body>

    <div id="wrapper">
        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header"></h1>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            Current updates
                        </div>
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-lg-6">
                                   <form role="form" action="update_story.php" method="post"  enctype="multipart/form-data" class="contact_form">
                                       
                                        <div class="form-group" >
                                            <label>srno</label>
                                            <input class="form-control" placeholder="Enter Number" id="srno" name="srno" value="<?php echo $srno;?>"readonly>
                                        </div>
                                          <div class="form-group">
                                             <label>Department Name:</label>
                                           <select  class="form-control" id="dept_name" name="dept_name" onchange="" >
                                           <option value="">--Select--</option>
																													            	<?php
                                              $dept="SELECT * FROM `main_dept_category`";
                                             	$res = mysqli_query($GLOBALS["___mysqli_ston"], "SET NAMES utf8");	
																																									$res=mysqli_query($GLOBALS["___mysqli_ston"], $dept) or die('Query Failed: 4' . mysqli_error($GLOBALS["___mysqli_ston"]));
																																										while($rw = mysqli_fetch_assoc($res))
																																									 {
																																									    	$ddept_id=$rw['dept_id'];
																																												 $dept_name=$rw['dept_name'];
																																								 ?>
																																											<option value="<?php echo $ddept_id; ?>" <?php if($dept_id == $ddept_id) echo 'selected' ?>><?php echo $dept_name; ?></option>
																																									<?php																																		
																																										} 
																																										?> 											                                          
                                          </select>                                          
                                          </div>
                                          <div class="form-group">
                                         <label>Sub-department</label>   
                                          <input class="form-control" placeholder="Enter text" id="head" name="head" value="<?php echo $head1;?>">
                                      </div>
                                      
                                         <div class="form-group">
                                            <label>description</label>
                                            <input class="form-control" placeholder="Enter text" id="head1" name="head1" value="<?php echo $head;?>">
                                        </div>
                                         <input type="submit"  name="submit" value="submit" /> 
                               
                                     
                                     </form>
                                      <!--     <?php $_SERVER['PHP_SELF'];?> -->
                                </div>
                                <!-- /.col-lg-6 (nested) -->
                            </div>
                            <!-- /.row (nested) -->
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                      <div id="search_res" style="width:100%;" >                    
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="../bower_components/jquery/dist/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="../bower_components/metisMenu/dist/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="../dist/js/sb-admin-2.js"></script>

</body>

</html>
