ok

Mini Shell

Direktori : /home2/selectio/www/tnpsctestbatch.com/admin/
Upload File :
Current File : /home2/selectio/www/tnpsctestbatch.com/admin/standard-edit.php

<?php  include "header.php";

    $ids = $_GET['id'];
    $statement = $pdo->prepare("SELECT * FROM tbl_standard 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 Standard: </b></h3>
                </div>
                <div class="box-body">
                    <div class="col-lg-12">
                        
                        
                        
    <div id="content-div">
        <form action="" id="add_standared_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-4">
                    <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 WHERE status = 1");
                            $statement->execute();
                            $subjects = $statement->fetchAll(PDO::FETCH_ASSOC);
                            foreach($subjects as $subject){
                                
                                $selected = ($subject['id'] == $result[0]['subject_id']) ? 'selected' : '';
                            ?>
                            <option value="<?= htmlspecialchars($subject['id']) ?>" <?= $selected ?>><?= htmlspecialchars($subject['subject_name']) ?></option>
                            <?php } ?>
                        </select>
                    </div>
                </div>
                <div class="col-md-4">
                    <div class="form-group">
                        <label class="required" for="file">Standard</label>                                    
                        <select name="standard" id="standard" class="form-control tip select2">
                            <option value="">-- Select Standard --</option>
                            <option <?php if($result[0]['standard'] == '6th Standard') { echo 'selected'; } ?> value="6th Standard">6th Standard </option>
                            <option <?php if($result[0]['standard'] == '7th Standard') { echo 'selected'; } ?> value="7th Standard">7th Standard </option>
                            <option <?php if($result[0]['standard'] == '8th Standard') { echo 'selected'; } ?> value="8th Standard">8th Standard </option>
                            <option <?php if($result[0]['standard'] == '9th Standard') { echo 'selected'; } ?> value="9th Standard">9th Standard </option>
                            <option <?php if($result[0]['standard'] == '10th Standard'){ echo 'selected'; } ?>  value="10th Standard">10th Standard </option>
                            <option <?php if($result[0]['standard'] == '11th Standard'){ echo 'selected'; } ?>  value="11th Standard">11th Standard </option>
                            <option <?php if($result[0]['standard'] == '12th Standard'){ echo 'selected'; } ?>  value="12th Standard">12th Standard </option>
                        </select>
                   
                   
                    </div>
                </div>
                <div class="col-md-4">
                    <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[0]['status']=='1'){ echo 'selected'; } ?>> Active </option>
                            <option value ="0" <?php if($result[0]['status']=='0'){ echo 'selected'; } ?>> In-Active </option>
                        </select>
                    </div>
                </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_standared" name="add_standared" value="Update Standared"  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="standard-edit.php?id=<?=$ids?>"><button class="btn btn-primary" ><i class="fa fa-refresh"></i> Reset Form</button></a>
    <a href="standard-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>

    $('#add_standared_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_standared_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