
PK 
<?php
include("header.php");
@extract($_POST);
$sql="SELECT * FROM jeff_news where id='".$_GET['id']."'";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_row($result);
$fetch_news_title=stripslashes($row['0']);
$fetch_news_description=stripslashes($row['1']);
$fetch_news_image=stripslashes($row['2']);
$fetch_status=stripslashes($row['3']);
if(isset($_POST['submit']))
{
$qry1="SELECT * FROM jeff_news where id='".$_GET['id']."'";
$result = mysqli_query($conn, $qry1);
$errors=array();
$current_times = str_replace(':', '_', $current_time);
$curdatetimesss=$current_date.'_'.$current_times;
$file_size=$_FILES["uploadedimage"]["size"];
$temp_name=$_FILES["uploadedimage"]["tmp_name"];
$file_type=$_FILES["uploadedimage"]["type"];
$target_path="uploads/news_img/";
$file_ext=explode('.',$_FILES["uploadedimage"]["name"]);
$expensions=array("jpeg","jpg","png");
if($_FILES["uploadedimage"]["name"]!='')
{
$image=$curdatetimesss.'_'.$_FILES["uploadedimage"]["name"];
$file_name=$image;
if($file_name!='')
{
$path = "uploads/news_img/".$row['image']."";
unlink($path);
$subqry=",news_image='$file_name'";
move_uploaded_file($temp_name,$target_path.$file_name);
}
else{
$subqry='';
}
}
$result=mysqli_query($conn, "UPDATE jeff_news SET news_title='$news_title',news_description='$news_description' where id='".$_GET['id']."'");
echo "<script>window.location='news_management.php?msg=update';</script>";
}
?>
<script>
function validate()
{
if(document.news_management.news_title.value=="")
{
document.getElementById("error_message").innerHTML='<p style="color:red;padding-top:5px;">Enter Your News</p>';
news_management.news_title.focus();
return(false);
}
else
{
document.getElementById("error_message").innerHTML='<span><font color="#FF0000"></font></span>';
}
if(document.news_management.news_description.value=="")
{
document.getElementById("error_message").innerHTML='<p style="color:red;padding-top:5px;">Enter your description</p>';
news_management.news_description.focus();
return(false);
}
else
{
document.getElementById("error_message").innerHTML='<span><font color="#FF0000"></font></span>';
}
}
</script>
<style>
#header_hover:hover{
background-color:#000 ! important;
}
</style>
<div id="wrapper">
<?php include('sidebar.php');?>
<div id="page-wrapper" class="gray-bg">
<?php include('afterlog_top.php'); ?>
<!--------- Title ------------>
<div class="row wrapper border-bottom white-bg page-heading">
<div class="col-lg-10">
<h2>Edit News</h2>
<ol class="breadcrumb">
<li>
<a href="dashboard.php">Home</a>
</li>
<li class="active">
<strong>Edit News</strong>
</li>
</ol>
</div>
<div class="col-lg-2">
</div>
</div>
<!--------- End Title ------------>
<div class="wrapper wrapper-content">
<div class="row animated fadeInRight">
<div class="col-md-12">
<div class="ibox float-e-margins">
<div class="ibox-title">
<a href="" class="btn btn-danger btn-xs" id="header_hover" ><h5 >Add</h5></a>
<a href="news_management.php" class="btn btn-primary btn-xs" ><h5 >News Management</h5></a>
<div class="pull-right tooltip-demo ibox-tools">
<a class="collapse-link">
<i class="fa fa-chevron-up"></i>
</a>
<a class="close-link">
<i class="fa fa-times"></i>
</a>
</div>
</div>
<!---------------- Form ---------------->
<div class="ibox-content">
<div class="row">
<div class="col-lg-1"></div>
<div class="col-lg-10">
<span id="error_message" style="color:#FF0000;font-size:14px;text-align: center;font-weight:600;"></span>
<form class="form-horizontal" enctype="multipart/form-data" id="news_management" name="news_management" method="post" action="" onsubmit="return validate();">
<div class="form-group">
<label style="text-align:left;" class="col-lg-4 control-label">news Title <span style="color:#FF0000;">*</span></label>
<div class="col-lg-8">
<input style="color:#777;" name="news_title" id="news_title" placeholder="News Title" type="text" class="form-control" value="<?php echo $fetch_news_title; ?>"/>
</div>
</div>
<div class="form-group">
<label style="text-align:left;" class="col-lg-4 control-label">news Description <span style="color:#FF0000;">*</span></label>
<div class="col-lg-8">
<textarea style="color:#777;" name="news_description" id="news_description" placeholder="News Description" type="text" class="form-control" /><?php echo $fetch_news_description; ?></textarea>
</div>
</div>
<div class="form-group">
<label style="text-align:left;" class="col-lg-4 control-label">News Image<span style="color:#FF0000;">*</span></label>
<div class="fileinput fileinput-new input-group" data-provides="fileinput">
<div class="form-control" data-trigger="fileinput">
<i class="glyphicon glyphicon-file fileinput-exists"></i>
</div>
<span class="input-group-addon btn btn-default btn-file">
<span class="fileinput-new">Select file</span>
<input type="file" id="uploadedimage" name="uploadedimage" placeholder="Enter upload image Here...">
<span class="fileinput-exists">Change</span>
</span>
<a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Remove</a>
</div>
</div>
<div class="form-group">
<center>
<img src="./uploads/news_img/<?php echo $fetch_news_image;?>"alt="" height="90" width="200">
</center>
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-4 col-lg-12">
<input class="btn btn-danger" type="button" value="Back" onclick="window.history.back();">
<input class="btn btn-success" type="submit" name="submit" value="submit">
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
include("footer.php")
?></div>
</div>
</body>
<script>
//================ Date Picker==============
$(document).ready(function(){
$('#data_1 .input-group.date').datepicker({
todayBtn: "linked",
keyboardNavigation: false,
forceParse: false,
calendarWeeks: true,
autoclose: true,
format: "yyyy-mm-dd"
});
$(".touchspin3").TouchSpin({
verticalbuttons: true,
buttondown_class: 'btn btn-white',
buttonup_class: 'btn btn-white'
});
$('.dual_select').bootstrapDualListbox({
selectorMinimalHeight: 160
});
});
</script>


PK 99