<?php 
include('inc/header.php');
include('inc/sidebar.php');
 
$add_video = new website();
 
@$edit_id = $_GET['edit'];
  
@$edit_id = $_GET['edit'];
if(isset($_REQUEST['submit']) && $edit_id==0)
{
    $add_video->add_video($_POST);
}
if(isset($_POST['submit']) && $edit_id!=0)
{
    $add_video->update_video($_POST,$edit_id);
}
if($edit_id!=0)
{
    $get_video_info = $add_video->fetch_rows("tbl_video","where id=$edit_id");
}
  
?>

<div class="container">


 <div class="row">
                        <div class="col-xl-7 mx-auto">

                            <h6 class="mb-0 text-uppercase">Video Form</h6>
                            <hr/>
                            
                            <div class="card border-top border-0 border-4 border-primary">
                                <div class="card-body p-5">
                                    <div class="card-title d-flex align-items-center">
                                        <div><i class="fa fa-ticket"></i>
                                        </div>
                                        <h5 class="mb-0 text-primary">Add Video</h5>
                                    </div>
                                    <hr>
                                  <form method="post" enctype="multipart/form-data">
                            <div class="row"> 
                            
                            <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Title *</label>
                                        <input type="text" class="form-control" placeholder="Enter Title"  name="title" id="title" value="<?=$get_video_info['title']?>">

                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>

                                  <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Youtube Video Url *</label>
                                        <input type="text" class="form-control" placeholder="Enter Youtube Video Url"  name="video_url" id="title" value="<?=$get_video_info['video_url']?>">

                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>
                                
                            
                            </div>  <br><br>                          
                            <button type="submit" class="btn btn-primary mr-2" name="submit">Submit</button>
                            <button type="reset" class="btn btn-danger">Reset</button>



                        </form>
                                </div>
                            </div>
                           
                        </div>
                    </div>

 
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$("#mobile_no").on("keypress", function(evt) {
  var keycode = evt.charCode || evt.keyCode;
  if (keycode == 46) {
    return false;
  }
});
 

    CKEDITOR.replace('editor', {
        filebrowserUploadUrl: 'ck_upload.php',
        filebrowserUploadMethod: 'form'
    });
    /*CKEDITOR.replace('editor2', {
        filebrowserUploadUrl: 'ck_upload.php',
        filebrowserUploadMethod: 'form'
    });
    */
    
    </script>
 <?php 
include "inc/footer.php";
    ?>

