ok

Mini Shell

Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/
Upload File :
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/edit-blog.php

<?php  include "header.php";

    $ids = $_GET['id'];
    $statement = $pdo->prepare("SELECT * FROM tbl_blog WHERE id=".$ids);
    $statement->execute();
    $result = $statement->fetchAll(PDO::FETCH_ASSOC);
                        

?>



<div class="content-wrapper" style="background:white;">
        <div class="clearfix"></div>

<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div>
                <div class="box-header">
                    <h3 class="box-title"><b>Edit Blog: </b></h3>
                </div>
                <div class="box-body">
                    <div class="col-lg-12">
                        
                        
                        
    <div id="content-div">
        <form action="" id="edit_blog_form" enctype="multipart/form-data" method="post" accept-charset="utf-8">
             <input type="hidden" name="ids"  id="question" value="<?= $ids ?>" autocomplete="off" required="required" />
          
              <div class="row">
                  
                 <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="file">Type</label>                                    
                        <select name="blog_type" id="blog_type" class="form-control tip select2">
                            <option >Select</option>
                            <option <?php if($result[0]['type']==1){ echo 'selected'; } ?> value="1">Active Recent Article</option>
                            <option  <?php if($result[0]['type']==0){ echo 'selected'; } ?>  value="0">In-Active Recent Article</option>
                        </select>
                    </div>
                </div>
                
                 <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="name">Blog Name</label>                                    
                        <input type="Text" name="name"  id="name" value="<?= $result[0]['name'] ?>" placeholder="Enter Name" class="form-control tip" autocomplete="off" required="required" />
                    </div>
                </div>
                
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="heading">Blog Heading</label>                                    
                        <input type="Text" name="heading"  id="heading" value="<?= $result[0]['heading'] ?>" placeholder="Enter Heading" class="form-control tip" autocomplete="off" required="required" />
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="tag_line">Blog Tag Line</label>                                    
                        <input type="Text" name="tag_line"  id="tag_line" value="<?= $result[0]['tag_line'] ?>" placeholder="Enter Tag Line" class="form-control tip" autocomplete="off" required="required" />
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="date">Blog Date</label>                                    
                        <input type="date" name="date"  id="date" value="<?= $result[0]['date'] ?>" placeholder="Enter Date" class="form-control tip" autocomplete="off" required="required" />
                    </div>
                </div>
                
                 <div class="col-md-12">
                     <div class="form-group">
                         <label class="required" for="content">Blog Conten</label>
                         <textarea name="content" id="editor1"><?= htmlspecialchars($result[0]['content']) ?></textarea>
                     </div>
                 </div>
                
           
                
                <div class="col-md-6">
                   <div class="form-group">
                        <label class="required" for="old_thumpnail_image">Thumnail Image</label>       
                        <input type="hidden" name="old_thumpnail_image"  id="old_thumpnail_image" value="<?= $result[0]['thumpnail_image'] ?>" class="form-control tip" autocomplete="off" />
                        <input type="file" name="thumpnail_image"  id="thumpnail_image" value="" class="form-control tip" autocomplete="off" />
                        <?php 
                        if(!empty($result[0]['thumpnail_image'])){
                            echo '<img src="'.$result[0]['thumpnail_image'].'" alt="No Images" style="width: 50%;">';
                        }
                        ?>
                    </div>
                </div>
                 <div class="col-md-6">
                   <div class="form-group">
                        <label class="required" for="subject_image">Blog Image</label>       
                        <input type="hidden" name="old_blog_image"  id="old_blog_image" value="<?= $result[0]['blog_image'] ?>" class="form-control tip" autocomplete="off" />
                        <input type="file" name="blog_image"  id="blog_image" value="" class="form-control tip" autocomplete="off" />
                        <?php 
                        if(!empty($result[0]['blog_image'])){
                            echo '<img src="'.$result[0]['blog_image'].'" alt="No Images" style="width: 50%;">';
                        }
                        ?>
                    </div>
                </div>
                
                
                  <div class="col-md-6">
                        <div class="form-group">
                            <label for="description">Description *</label>                                    
                            <input type="text" name="description"  id="description" value="<?= $result[0]['description'] ?>" placeholder="Enter description" class="form-control tip" autocomplete="off" required="required" />
                        </div>
                    </div>
                    
                      <div class="col-md-6">
                        <div class="form-group">
                            <label for="title">Title *</label>                                    
                            <input type="text" name="title"  id="title" value="<?= $result[0]['title'] ?>" placeholder="Enter title" class="form-control tip" autocomplete="off" required="required" />
                        </div>
                    </div>
                    
                      <div class="col-md-6">
                        <div class="form-group">
                            <label for="keyword"> Keyword * </label>                                    
                            <input type="text" name="keyword"  id="keyword" value="<?= $result[0]['keyword'] ?>" placeholder="Enter keyword" class="form-control tip" autocomplete="off" required="required" />
                        </div>
                    </div>
                
              
            
                <div class="col-md-12" style="display: flex;justify-content: center;margin-top: 3%;">
                    <div class="form-group">
                        <input type="submit" id="add_subject" name="add_subject" value="Update Blog"  class="btn btn-success" />
                    </div>
                </div>
            
        </form>
    </div>

<div id="loading-div"  style="display: none;">
    <img src="images/gif/successfull.gif" style="margin-left: 37%;width: 25%;padding-bottom: 5%;">
</div>

<div class="form-group" style="text-align:center;">
    <a href="blog-edit.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a>
    <a href="blog-details.php"><button class="btn btn-warning" ><i class="fa fa-chevron-left"></i> Back to List</button></a>
 </div>
                    
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
</section>

<style>
    table,td,th{
        padding:5px;
    }
    th{
        border: 1px solid black;
    }
    td{
        border: 1px solid black;
        border-style: dashed;
    }
</style>

<script src="https://cdn.ckeditor.com/ckeditor5/34.0.0/classic/ckeditor.js"></script>
<script>
    ClassicEditor
        .create(document.querySelector('#editor1'))
        .catch(error => {
            console.error(error);
        });
</script>


<script>

    $('#edit_blog_form').on('submit', function(e){
        console.log("Click And Form Working");
      
            e.preventDefault();
            $('#loading-div').show();
            $('#content-div').hide();
            var formData = new FormData(this);
            formData.append('type', 'edit_blog_form');
                $.ajax({
                url: 'add-api/edit-subject-form.php',
                type: 'post',
                dataType: 'json',
                data: formData,
                cache: false,
                contentType: false,
                processData: false,
                enctype: 'multipart/form-data',
                success: function (response) {
                    if(response['status']==200){
                         alert(response['message']);
                         $("#add_shifts .close").click();
                         $('#shift_add_form').trigger("reset");

                         $('#loading-div').hide();
                         $('#content-div').show();
                    }else{
                        alert(response['message']);
                        $('#loading-div').hide();
                        $('#content-div').show();
                    }
                    
                   
                }
            });
                
    });
</script>


<?php include "footer.php";?>

Zerion Mini Shell 1.0