ok

Mini Shell

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

<?php  include "header.php";

    $ids = $_GET['id'];
    $statement = $pdo->prepare("SELECT * FROM tbl_topic WHERE id=".$ids);
    $statement->execute();
    $result_topic = $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 Topic: </b></h3>
                </div>
                <div class="box-body">
                    <div class="col-lg-12">
                        
                        
                        
    <div id="content-div">
        
   
        
        <form action="" id="edit_topic_form" enctype="multipart/form-data" method="post" accept-charset="utf-8">
            <input type="hidden" name="ids"  id="syllabus" value="<?= $result_topic[0]['id'] ?>"/>
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="file">Select Subject</label>     
                        <select name="subject_type" id="subject_type" onchange="subject()" class="form-control tip select2">
                            <option>--- Select Subject ---</option>
                                <?php 
                                    $subject_query = $pdo->prepare("SELECT * FROM tbl_subject WHERE status=1");
                            		$subject_query->execute();
                            		$results = $subject_query->fetchAll(PDO::FETCH_ASSOC);
                                    foreach($results as $subject){
                                ?>
                                
                            <option value="<?=$subject['id']?>" <?php if( $result_topic[0]['subject_id'] == $subject['id']){ echo 'selected'; } ?>  ><?=$subject['subject_name']?></option>
                            
                            <?php } ?>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="file">Select Standard</label>
                        
                        <select name="standard_type" id="standard_type" class="form-control tip select2">
                            
                             <?php 
                                    $standard_query = $pdo->prepare("SELECT * FROM tbl_standard WHERE status=1");
                            		$standard_query->execute();
                            		$standard_results = $standard_query->fetchAll(PDO::FETCH_ASSOC);
                                    foreach($standard_results as $standards){
                                ?>
                                
                            <option value="<?=$standards['id']?>" <?php if( $result_topic[0]['standard_id'] == $standards['id']){ echo 'selected'; } ?>  ><?= $standards['standard'] ?></option>
                            
                            <?php } ?>
                               
                        </select>
                    </div>
                </div>
                
                <div class="col-md-3">
                    <div class="form-group">
                        <label class="required" for="file">Topic</label>                                    
                        <input type="Text" name="syllabus"  id="syllabus" value="<?= $result_topic[0]['topic'] ?>" placeholder="Enter Syllabus" class="form-control tip" autocomplete="off" required="required" />
                    </div>
                </div>
                
                <div class="col-md-3">
                    <div class="form-group">
                        <label class="required" for="file">Syllabus/Topic</label>                                    
                        <input type="Text" name="topic"  id="topic" value="<?= $result_topic[0]['syllabus'] ?>" placeholder="Enter Topic" class="form-control tip" autocomplete="off" required="required" />
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="form-group">
                        <label class="required" for="file">Group</label>                                    
                        <input type="Text" name="group_topic"  id="group_topic" value="<?= $result_topic[0]['group_topic'] ?>" placeholder="Enter group_topic" class="form-control tip" autocomplete="off" required="required" />
                    </div>
                </div>
                
                <div class="col-md-3">
                    <div class="form-group">
                        <label class="required" for="file">Off Page Description Content</label>                                    
                        <input type="Text" name="discription_content"  id="discription_content" value="<?= $result_topic[0]['discription_content'] ?>" placeholder="Enter Description Content" class="form-control tip" autocomplete="off" required="required" />
                    </div>
                </div>
                
                <div class="col-md-3">
                    <div class="form-group">
                        <label class="required" for="file">Off Page Description Keyword</label>                                    
                        <input type="Text" name="discription_keyword"  id="discription_keyword" value="<?= $result_topic[0]['discription_keyword'] ?>" placeholder="Enter Description keyword" class="form-control tip" autocomplete="off" required="required" />
                    </div>
                </div>
                
                <div class="col-md-3">
                    <div class="form-group">
                        <label class="required" for="file">Off Page Description Title</label>                                    
                        <input type="Text" name="discription_title"  id="discription_title" value="<?= $result_topic[0]['discription_title'] ?>" placeholder="Enter Description Title" class="form-control tip" autocomplete="off" required="required" />
                    </div>
                </div>
                
                <div class="col-md-3">
                    <div class="form-group">
                        <label class="required" for="file"> On page Content</label>                                    
                        <input type="Text" name="topic_content"  id="topic_content" value="<?= $result_topic[0]['topic_content'] ?>" placeholder="Enter  On Page Content" class="form-control tip" autocomplete="off" required="required" />
                    </div>
                </div>
                
                <div class="col-md-3">
                    <div class="form-group">
                        <label class="required" for="status">Status</label>
                        
                        <select name="status" id="status" class="form-control tip select2">
                            
             
                                
                            <option value="1" <?php if( $result_topic[0]['status'] == 1){ echo 'selected'; } ?>  >Active</option>
                            <option value="0" <?php if( $result_topic[0]['status'] == 0){ echo 'selected'; } ?>  >In-Active</option>
                            
                           
                               
                        </select>
                    </div>
                </div>
                
                
                
                
                <!--<div class="col-md-3">-->
                <!--    <span id="add_row" class="btn btn-success" style="margin-top: 7%;background: #6bc5fa;font-weight: 800;border: 1px solid beige;border-radius: 20px;">-->
                <!--        <i class="bi bi-plus"></i>Add Row-->
                <!--    </span>-->
                <!--</div>-->
                
                
            </div>
            <div class="row">
                <div id="add_topic_row"></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_topic" name="add_topic" value="Update Topic"  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="topic-edit.php?id=<?=$ids?>"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a>
    <a href="topic-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>

// $(document).ready(function(){
//     subject();
// });

function subject(){
   
    
    $("#standard_type").empty();
    
 var  subject = $("#subject_type").val();
          
            $.ajax({
                url:'api/select_standard.php',
                type:'POST',
                data:{type:'standard',subject:subject},
                success:function(data)
                {
                    $("#standard_type").append(data);
                    
                }
                
            });
            
};

    $('#edit_topic_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_topics_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");
                         emp_datas();
                         $('#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