File: /home/nyiet8349bzl/Backup/sbc_back/homedir/public_html/bsadmin-portal/edit-news.php
<?php
//error_reporting(-1);
include("../classes/site_class.php");
$obj = new Site();
if($_SESSION['admin']['user_id']=='')
{
echo "<script>window.location.href='index.php'</script>";
}
if(isset($_REQUEST['action']) and !empty($_REQUEST['action']) and ($_REQUEST['action']=='updateNews'))
{
$resp = $obj->updateNews();
if($resp==7)
{
echo "<script>alert('Pdf / Word / Image file is greater then 15 MB')</script>";
}
if($resp==8)
{
echo "<script>alert('Select file extension not Pdf / Word / Image')</script>";
}
if($resp==0)
{
echo "<script>alert('Required parameter missing')</script>";
}
if($resp==5)
{
echo "<script>alert('News update Successfully')</script>";
echo "<script>window.location.href='manage-news.php'</script>";
}
if($resp==1 )
{
echo "<script>alert('News is not save, Please try later')</script>";
echo "<script>window.location.href='edit-news.php'</script>";
}
}
if(isset($_REQUEST['id'],$_REQUEST['action']) and ($_REQUEST['action']=='editNews') and !empty($_REQUEST['id']))
{
$data = mysqli_fetch_array(mysqli_query($obj->myconn, "SELECT * FROM news where id='".$_REQUEST['id']."'"));
}
?>
<!doctype html>
<html class="fixed">
<head>
<title>News :: SBSC 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>News 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>News Management</span></li>
<li><span>Edit News</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 News</h2>
</header>
<div class="panel-body">
<form class="form-horizontal form-bordered" name="news_form" method ="Post" action="" enctype="multipart/form-data">
<input type="hidden" name="action" value="updateNews" />
<input type="hidden" name="id" value="<?php echo $data['id']; ?>" />
<div class="form-group">
<label class="control-label col-sm-2" for="category">News Category*</label>
<div class="col-sm-10">
<input type="text" class="form-control" name="name" value="<?php echo $data['category']; ?>" readonly>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="inputDefault">News Title*</label>
<div class="col-md-10">
<input type="text" class="form-control" name="name" value="<?php echo $data['name']; ?>">
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="inputDefault">Select Pdf*</label>
<div class="col-md-10">
<object width="700" height="150" data="../uploads/pdf/<?php echo $data['image'];?>"></object>
<br/><br/>
<input type="file" name="image" class="form-control" >
<p class="hint">Select only PDF, Word, Png, Jpg, Jpeg file for upload</p>
</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" />
</div>
</div>
</form>
</div>
</section>
</div>
</div>
</section>
</div>
</section>
<?php include("inc-footer.php"); ?>
</body>
</html>