D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
diafrica
/
spre.dominicaninstitute.edu.ng
/
Filename :
editfaq.php
back
Copy
<?php session_start(); include 'inc/config.php'; include './inc/functions.php'; $Functions = new Functions(); if (!isset($_SESSION['manager'])) { header('location: ./admin-auth'); exit(); } $page_title; $page_title = ucfirst(basename(__FILE__, '.php')); if ($page_title === 'index') { $page_title = 'Home'; } $page_title = "Administator's Dashboard"; include 'sections/pages-header.php'; $message = ''; function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } if (isset($_GET['faq_id'])) { $sn = $_GET['faq_id']; $get_news = "select * from faq where sn='$_GET[faq_id]'"; $run_post = mysqli_query($con, $get_news); while ($row_post = mysqli_fetch_array($run_post)) { $titler = $row_post['titler']; //$category = $row_post['caption']; //$dater = $row_post['dater']; //$uploaded_image = $row_post['image']; $contenter = $row_post['contenter']; } } ?> <div class="container" style="margin-top:50px"> <div> <a href="./addfaq"><h2> Manage FAQ</h2></a> </div> <hr> <div> <h1>Update FAQ</h1> <?php if ( $_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['update_news']) ) { $title = $caption = $image = $ckeditor = ''; $title = test_input($_POST['title']); //$dater = test_input($_POST['dater']); //$caption = test_input($_POST['caption']); $ckeditor = $_POST['ckeditor']; //$file_name = $_FILES['image']['name'] // ? $_FILES['image']['name'] // : $uploaded_image; // $file_path = 'uploads/programme/' . $file_name; // move_uploaded_file($_FILES['image']['tmp_name'], $file_path); $feedback = "UPDATE faq SET titler='$title',contenter='$ckeditor' WHERE sn =$sn"; // echo $feedback; // exit(); $run = mysqli_query($con, $feedback); if ($feedback) { echo "<div class='alert alert-success alert-dismissible' role='alert'> FAQ Updated Successfully! </div>"; } else { echo "<div class='alert alert-danger alert-dismissible' role='alert'> An error occured, please try again! </div>"; } } ?> <?php $get_news = "select * from faq where sn='$_GET[faq_id]'"; $run_post = mysqli_query($con, $get_news); while ($row_post = mysqli_fetch_array($run_post)) { $title = $row_post['titler']; //$caption = $row_post['caption']; //$dater = $row_post['dater']; //$uploaded_image = $row_post['image']; $content = $row_post['contenter']; } ?> <br> <form action="" method="post" enctype="multipart/form-data"> <div class="row clearfix"> <div class="col-md-8 col-sm-12 col-xs-12"> <div class="form-group"> <input type="text" name="title" class="form-control" value="<?= $title ?>" placeholder="Add FAQ Question" required> </div> <!-- <div class="form-group"> <input type="text" name="caption" class="form-control" placeholder="Add Community location" value=""required> </div> --> <!-- <div class="form-group"> <img src="uploads/programme/ style="width: 300px"/> <p>Change Community Image</p> <input type="file" name="image" class="form-control" size="60"> </div> --> <!-- <div class="form-group"> <input type="date" name="dater" class="form-control" value=" //$dater ?>" required> </div> --> <div class="form-group"> <textarea name="ckeditor" class="form-control textarea required" ><?= $content ?></textarea> <script> CKEDITOR.replace( 'ckeditor' ); // 850 pixels wide. config.width = '100%'; config.height = '8700px' </script> </div> <div class="form-group"> <input type="submit" name="update_news" value="Update FAQ" class="thm-btn thm-color width-100"/> </div> </div> </div> </form> </div> <hr> </div> </div> <?php include_once 'sections/footer.php'; ?>