File: /home/nyiet8349bzl/Backup/sbc_back/homedir/public_html/admin-e-resources/edit-subject.php
<?php
//error_reporting(-1);
include("../classes/resources_class.php");
$obj = new Work();
if($_SESSION['admin']['id']=='')
{
echo "<script>window.location.href='index.php'</script>";
}
if(isset($_REQUEST['action']) and !empty($_REQUEST['action']) and ($_REQUEST['action']=='updateSubject'))
{
$resp = $obj->updateSubject();
if($resp==0)
{
echo "<script>alert('Required parameter missing')</script>";
}
if($resp==5)
{
echo "<script>alert('Department update Successfully')</script>";
echo "<script>window.location.href='subject-list.php'</script>";
}
if($resp==1 )
{
echo "<script>alert('Department is not save, Please try later')</script>";
echo "<script>window.location.href='edit-subject.php'</script>";
}
}
if(isset($_REQUEST['id'],$_REQUEST['action']) and ($_REQUEST['action']=='editSubject') and !empty($_REQUEST['id']))
{
$data = mysqli_fetch_array(mysqli_query($obj->myconn, "SELECT * FROM subject WHERE id='".$_REQUEST['id']."'"));
}
?>
<!doctype html>
<html class="fixed">
<head>
<title>Admin</title>
<?php include("inc-head.php");?>
</head>
<body>
<section class="body">
<!-- start: header -->
<?php include("inc-header.php"); ?>
<!-- end: header -->
<div class="inner-wrapper">
<!-- start: sidebar -->
<?php include("inc-navigation.php"); ?>
<!-- end: sidebar -->
<section role="main" class="content-body">
<header class="page-header">
<h2>Department Management</h2>
<div class="right-wrapper pull-right">
<ol class="breadcrumbs">
<li>
<a href="dashboard.php">
<i class="fa fa-home"></i>
</a>
</li>
<li><span>Department Management</span></li>
<li><span>Edit Department</span></li>
</ol>
<a class="sidebar-right-toggle"></a>
</div>
</header>
<!-- start: page -->
<div class="row">
<div class="col-lg-12">
<section class="panel">
<header class="panel-heading">
<div class="panel-actions">
<a href="#" class="panel-action panel-action-toggle" data-panel-toggle></a>
<a href="#" class="panel-action panel-action-dismiss" data-panel-dismiss></a>
</div>
<h2 class="panel-title">Edit Department</h2>
</header>
<div class="panel-body">
<form class="form-horizontal form-bordered" name="subject_form" method="Post" action="" enctype="multipart/form-data">
<input type="hidden" name="action" value="updateSubject" />
<input type="hidden" name="id" value="<?php echo $data['id']; ?>" />
<div class="form-group">
<label class="control-label col-sm-2" for="category">Department Name*</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="subject" value="<?php echo $data['name']; ?>">
</div>
</div>
<div class="row">
<div class="col-sm-2"></div>
<div class="col-sm-1 text-center">
<input type="submit" class="btn btn-primary" name="Update" value="Update" onclick="return Validate_Subject();" />
</div>
</div>
</form>
</div>
</section>
</div>
</div>
</section>
</div>
</section>
<?php include("inc-footer.php"); ?>
</body>
</html>