Viewing file: edit_gallery.php (7.92 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include 'conn.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php include('title.php') ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" href="dist/css/adminlte.min.css">
<link rel="stylesheet" href="plugins/summernote/summernote-bs4.css">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
<link rel="shortcut icon" type="image/png" href="images/fav.png">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/themify-icons.css">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/red.css" id="style_theme">
<link rel="stylesheet" href="css/responsive.css">
<link rel="stylesheet" href="charts/css/morris.css">
<link rel="stylesheet" href="css/jquery-jvectormap.css">
<link rel="stylesheet" href="datatable/dataTables.bootstrap4.min.css">
</head>
<?php
$id = $_GET['edit'];
$row = mysqli_query($con, "SELECT * FROM teams WHERE id = $id");
$roww = mysqli_fetch_array($row);
if (isset($_POST['update'])) {
$title = mysqli_real_escape_string($con, $_POST['title']);
$designation = mysqli_real_escape_string($con, $_POST['designation']);
$designation_fa = mysqli_real_escape_string($con, $_POST['designation_fa']);
$title_fa = mysqli_real_escape_string($con, $_POST['title_fa']);
// Check if a new image is provided
if ($_FILES['lis_img']['name'] != '') {
// Remove the old image if it exists
if (!empty($roww['img'])) {
$old_image_path = "images/teams/" . $roww['img'];
unlink($old_image_path);
}
$lis_img = rand() . $_FILES['lis_img']['name'];
$tempname = $_FILES['lis_img']['tmp_name'];
$folder = "images/teams/" . $lis_img;
move_uploaded_file($tempname, $folder);
} else {
// If no new image is provided, retain the old image
$lis_img = $roww["img"];
}
$insertdata = mysqli_query($con, "UPDATE teams SET title='$title', designation='$designation', img='$lis_img', title_fa='$title_fa', designation_fa='$designation_fa' WHERE id=$id");
if ($insertdata) {
echo "<script>alert('Updated Successfully');</script>";
echo "<script>window.location.href = 'view-teams.php'</script>";
} else {
echo "<script>alert('Update Failed');</script>";
}
}
?>
<body>
<!-- Pre Loader -->
<div class="loading">
<div class="spinner">
<div class="double-bounce1"></div>
<div class="double-bounce2"></div>
</div>
</div>
<!--/Pre Loader -->
<div class="wrapper">
<!-- Sidebar -->
<?php include('sidebar.php') ?>
<!-- /Sidebar -->
<!-- Page Content -->
<div id="content">
<div>
<?php include('topbar.php') ?>
</div>
<div class="row no-margin-padding">
<div class="col-md-6">
<h3 class="block-title">Edit Gallery</h3>
</div>
<div class="col-md-6">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="index.php">
<span class="ti-home"></span>
</a>
</li>
<li class="breadcrumb-item">Gallery</li>
</ol>
</div>
</div> <div class="col-sm-6">
<a href="view-teams.php" class="btn btn-success"><i class="fa fa-plus" aria-hidden="true"></i> View Gallery</a>
</div>
<div class="row justify-content-center">
<section class="content">
<div class="row">
<div class="col-md-8" >
<form method="post" enctype="multipart/form-data">
<div style="width: 1000px;">
<div class="card card-outline card-info">
<div class="card-header">
<div class="form-group">
<label>Enter Name</label>
<input name="title" value="<?php echo $roww['title'] ?>" type="text" class="form-control" placeholder="Enter ...">
</div>
</div>
<div class="card-header" dir="rtl" style="text-align: right;">
<div class="form-group">
<label>نام</label>
<input name="title_fa" type="text" value="<?php echo $roww['title_fa'] ?>" class="form-control" placeholder=" وارد کردن...">
</div>
</div>
<div class="card-header">
<div class="form-group">
<label>Enter Designation</label>
<input name="designation" type="text" value="<?php echo $roww['designation'] ?>" class="form-control" placeholder="Enter ...">
</div>
</div>
<div class="card-header" dir="rtl" style="text-align: right;">
<div class="form-group">
<label>مقام</label>
<input name="designation_fa" type="text" value="<?php echo $roww['designation_fa'] ?>" class="form-control" placeholder=" وارد کردن ...">
</div>
</div>
<div class="card-body pad">
<!--
<label>Description</label>
<div class="mb-3">
<textarea name="descrip" placeholder="Enter Description" style="width: 100%;" rows="5" cols="23"></textarea>
</div>
</div>
<div class="card-body pad" dir="rtl" style="text-align: right;">
<label>جزئیات
</label>
<div class="mb-3">
<textarea name="descrip_fa" placeholder="وارد کردن جزئیات" style="width: 100%;" rows="5" cols="23"></textarea>
</div>
</div>
-->
<div class="card-header">
<div class="form-group">
<label for="exampleInputFile">Select Img<span style="color:red;">(only compresed)</span></label>
<p style="color:red;">img size 370px x 370px</p>
<input name="lis_img" type="file" value="<?php echo $roww['lis_img'] ?>">
</div>
</div>
<div class="card-header">
<div class="form-group">
<div class="row">
<div class="col-sm-6">
<!-- text input -->
<div class="form-group">
<button type="submit" name="update" class="btn btn-primary btn-lg">Publish</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
</div>
</div>
<!-- Back to Top -->
<a id="back-to-top" href="#" class="back-to-top">
<span class="ti-angle-up"></span>
</a>
<script src="js/jquery-3.2.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="datatable/jquery.dataTables.min.js"></script>
<script src="datatable/dataTables.bootstrap4.min.js"></script>
<script src="js/custom.js"></script>
<script src="js/custom-datatables.js"></script>
<script src="plugins/jquery/jquery.min.js"></script>
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="dist/js/adminlte.min.js"></script>
<script src="plugins/summernote/summernote-bs4.min.js"></script>
<script src="plugins/jquery/jquery.min.js"></script>
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="dist/js/adminlte.min.js"></script>
<script src="dist/js/demo.js"></script>
<!-- Summernote -->
<script src="plugins/summernote/summernote-bs4.min.js"></script>
<script>
$(function () {
// Summernote
$('.textarea').summernote()
})
</script>
</body>
</html>
|