ok

Mini Shell

Direktori : /proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/
Upload File :
Current File : //proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/questions-add1.php

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

<style>
    .btn-success.hover, .btn-success:active, .btn-success:hover{
        background-color: darkred;
        border-color: darkred;
    }
    .btn-success {
        background-color: darkviolet;
        border-color: #9400d3;
        /*border-radius: 20px;*/
    }
    .btn-primary {
        background-color: chocolate;
        border-color: #d2691e;
    }
    .btn-warning {
        background-color: tomato;
        border-color: #ff6347;
    }
</style>

<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>Add New Question: </b></h3>
                </div>
                <div class="box-body">
                    <div class="col-lg-12">
                        
                        <div id="loading-div"  style="display: none;">
                            <img src="images/gif/successfull.gif" style="margin-left: 37%;width: 25%;padding-bottom: 5%;">
                        </div>
    <div id="content-div">
        <form action="" id="add_question" enctype="multipart/form-data" method="post" accept-charset="utf-8">
            
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="file">Select Subject</label>                                    
                        <select name="subject" id="subject" class="form-control tip select2">
                            <option>-- Select Subject --</option>
                            <?php 
                                $statement = $pdo->prepare("SELECT * FROM tbl_subject");
                                $statement->execute();
                                $result = $statement->fetchAll(PDO::FETCH_ASSOC);
                                foreach($result as $subject){
                            ?>
                            
                            <option value="<?=$subject['id']?>"><?=$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" id="standard_type" class="form-control tip select2">
                            <option>-- Select Standard --</option>
                            <?php 
                                $standard_query = $pdo->prepare("SELECT * FROM tbl_standard");
                                $standard_query->execute();
                                $result = $standard_query->fetchAll(PDO::FETCH_ASSOC);
                                foreach($result as $standard){
                            ?>
                            
                            <option value="<?=$standard['id']?>"><?=$standard['standard']?></option>
                            
                            <?php } ?>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="file">Select Standard</label>                                    
                        <select name="questions_type" id="questions_type" class="form-control tip select2">
                            <option>-- Select Standard --</option>
                            <option value="1">Questions Type 1</option>
                            <option value="2">Questions Type 2</option>
                        </select>
                    </div>
                </div>
                
                
                <div id="row_questions"></div>
                
                <!--<div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Question</label>                                    
                        <input type="Text" name="question[]"  id="question" value="" placeholder="Enter Question" class="form-control tip" required="required" />
                    
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (A) </label>                                    
                        <input type="text" name="option_a[]"  id="option_a" value="" placeholder="Enter option" class="form-control tip" required="required" />
                    
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (B)</label>                                    
                        <input type="text" name="option_b[]"  id="option_b" value="" placeholder="Enter option" class="form-control tip" required="required" />
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (C)</label>                                    
                        <input type="text" name="option_c[]"  id="option_c" value="" placeholder="Enter option" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (d)</label>                                    
                        <input type="text" name="option_d[]"  id="option_d" value="" placeholder="Enter option" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Correct Answer</label>                                    
                        <select class="form-control tip select2" name="answer[]" id="answer">
                            <option>--- Select Correct Option ---</option>
                            <option value="A">A</option>
                            <option value="B">B</option>
                            <option value="C">C</option>
                            <option value="D">D</option>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="file">Youtube Video Link</label>                                    
                        <input type="text" name="video[]"  id="video" value="" placeholder="Enter URL" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="file">Upload Link</label>                                    
                        <input type="file" name="photo[]"  id="photo" value="" placeholder="" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="form-group">
                        <label class="required" for="file">Question Explanation</label>                                    
                        <textarea type="text" name="explanation[]"  id="explanation" value="" placeholder="Enter Explanation" class="form-control tip" required="required" style="height:100px;"/></textarea> 
                    </div>
                </div>-->
                
                
                            
            </div>
            
            <!--<span id="add_row" class="btn btn-success" style="background: #6bc5fa;font-weight: 800;border: 1px solid beige;border-radius: 20px;">
                <i class="bi bi-plus"></i>Add Row
            </span>-->
            
            
            <div id="sections"></div>
            <div class="col-md-12" style="display: flex;justify-content: center;margin-top: 3%;">
                    <div class="form-group">
                        <!--<label class="required" for="file">Action</label><br>-->
                        <input type="submit" id="add_question" name="add_question" value="Add Questions"  class="btn btn-success" />
                    </div>
                </div>
            
        </form>
    </div>



<div class="form-group" style="text-align:center;">
    <a href="questions-add.php"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a>
    <a href="questions.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>


<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>

<script>
   $('#standard_type').on('change', function() {
       //alert("venkat");
     $("#row_questions").empty();
     
     var appen_value = $('#standard_type').val();
        
       var new_row =`<div class="row">
                    <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Question</label>                                    
                        <input type="Text" name="question[]"  id="question" value="" placeholder="Enter Question" class="form-control tip" required="required" />
                    
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (A) </label>                                    
                        <input type="text" name="option_a[]"  id="option_a" value="" placeholder="Enter option" class="form-control tip" required="required" />
                    
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (B)</label>                                    
                        <input type="text" name="option_b[]"  id="option_b" value="" placeholder="Enter option" class="form-control tip" required="required" />
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (C)</label>                                    
                        <input type="text" name="option_c[]"  id="option_c" value="" placeholder="Enter option" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (d)</label>                                    
                        <input type="text" name="option_d[]"  id="option_d" value="" placeholder="Enter option" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Correct Answer</label>                                    
                        <select class="form-control tip select2" name="answer[]" id="answer">
                            <option>--- Select Correct Option ---</option>
                            <option value="A">A</option>
                            <option value="B">B</option>
                            <option value="C">C</option>
                            <option value="D">D</option>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="file">Youtube Video Link</label>                                    
                        <input type="text" name="video[]"  id="video" value="" placeholder="Enter URL" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="file">Upload Link</label>                                    
                        <input type="file" name="photo[]"  id="photo" value="" placeholder="" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="form-group">
                        <label class="required" for="file">Question Explanation</label>                                    
                        <textarea type="text" name="explanation[]"  id="explanation" value="" placeholder="Enter Explanation" class="form-control tip" required="required" style="height:100px;"/></textarea> 
                    </div>
                </div>
                
                <span id="add_row" class="btn btn-success" OnClick="venkat()" style="background: #6bc5fa;font-weight: 800;border: 1px solid beige;border-radius: 20px;">
                    <i class="bi bi-plus"></i>Add Row
                </span>
                
                </div>`;
                
            $('#row_questions').append(new_row);
        
       });
</script>

<script>

$(document).on('click', '.remove_class', function() {
        $(this).closest('.row').remove();
    });


function venkat() {
    var row = `<div class="row">
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Question</label>                                    
                        <input type="Text" name="question[]"  id="question" value="" placeholder="Enter Question" class="form-control tip" required="required" />
                    
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (A) </label>                                    
                        <input type="text" name="option_a[]"  id="option_a" value="" placeholder="Enter option" class="form-control tip" required="required" />
                    
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (B)</label>                                    
                        <input type="text" name="option_b[]"  id="option_b" value="" placeholder="Enter option" class="form-control tip" required="required" />
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (C)</label>                                    
                        <input type="text" name="option_c[]"  id="option_c" value="" placeholder="Enter option" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Option (d)</label>                                    
                        <input type="text" name="option_d[]"  id="option_d" value="" placeholder="Enter option" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Correct Answer</label>                                    
                        <select class="form-control tip select2" name="answer[]" id="answer">
                            <option>--- Select Correct Option ---</option>
                            <option value="A">A</option>
                            <option value="B">B</option>
                            <option value="C">C</option>
                            <option value="D">D</option>
                        </select>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="file">Youtube Video Link</label>                                    
                        <input type="text" name="video[]"  id="video" value="" placeholder="Enter URL" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="form-group">
                        <label class="required" for="file">Upload Link</label>                                    
                        <input type="file" name="photo[]"  id="photo" value="" placeholder="" class="form-control tip" required="required" /> 
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="form-group">
                        <label class="required" for="file">Question Explanation</label>                                    
                        <textarea type="text" name="explanation[]"  id="explanation" value="" placeholder="Enter Explanation" class="form-control tip" required="required" style="height:100px;"/></textarea> 
                    </div>
                </div>
                
                <span  class="remove_class btn btn-danger" style="font-weight: 800;border: 1px solid beige;border-radius: 20px;">Delete Row</span>
                            
            </div>`;
            
        $("#sections").append(row);
}

    $('#add_question').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', 'add_question');
                $.ajax({
                url: 'add-api/add-question-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