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

<div class="container">


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

                            <h6 class="mb-0 text-uppercase">Teacher 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 Image</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_partner_info['title']?>">

                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>
                                
                                   <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Designation *</label>
                                        <input type="text" class="form-control" placeholder="Enter Designation"  name="designation" id="Designation" value="<?=$get_partner_info['designation']?>">

                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>
                               
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label>Image</label>
                                        <input type="file" class="form-control image-file" name="image" <?php if($edit_id==0) echo 'required'; ?>>
                                    </div>
                                    <?php
                                    if($edit_id!=0)
                                    {
                                        if($get_partner_info['image']!='')
                                        {
                                            ?>
                                            <img src="../images/main_img/<?=$get_partner_info['image']?>" style="height:100px;width:100px; ">
                                            <?php
                                        }
                                    }
                                    ?>
                                </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";
    ?>

