<!-- Main content -->
                <section class="content">

                    <!-- Small boxes (Stat box) -->
                    <div class="row">
				
						
                                <form role="form" action="<?php echo site_url('aqadmin/add_slider');?>" method="post" enctype="multipart/form-data" id="myForm">
                       <div class="col-md-6">
                            <!-- general form elements -->
                            <div class="box box-primary">
                                <div class="box-header">
                                    <h3 class="box-title">
                                        <?php

                                        if(empty($slider_row))
                                        {
                                            echo "Add Slider";
                                        }
                                        else
                                        {
                                            echo "Edit Slider";
                                        }
                                        ?>
                                    </h3>
                                </div><!-- /.box-header -->
                                <!-- form start -->
                                <?php 
   if($this->session->flashdata('success_msg')){?>
     <div style="color:green"><?php echo $this->session->flashdata('success_msg');?></div>    
    <?php  } ?>
                                    <div class="box-body">
                                    <div class="form-group">
                                            <label for="exampleInputEmail1">Slider Name</label>
                                            <input type="text" name="slider_name" class="form-control" placeholder="Slider name" value="<?php if(empty($slider_row)) { echo set_value('slider_name'); } else{ echo $slider_row->slider_name; } ?>" data-validation="required alphanumeric" data-validation-allowing=" " autocomplete="off">
                                            <?php if(form_error('slider_name') != ""){?>     
     <div style="color:red"><?php echo "Enter brand name.";?></div>
       <?php } ?> 
                                        </div>
                                        
                                    
           <div class="form-group">
                                            <label for="exampleInputEmail1">Slider Image</label>
                                            <input type="file" class="form-control" id="inputPassword3" placeholder="Slider Image" name="slider_image" <?php if(empty($slider_row)) { ?> data-validation="required mime size" data-validation-max-size="500kb" data-validation-allowing="jpg, png, gif" data-validation-error-msg-size="You can not upload images larger than 500kb" data-validation-error-msg-mime="You can only upload images" data-validation-error-msg-required="No image selected"<?php } else {?> data-validation="mime size" data-validation-max-size="500kb" data-validation-allowing="jpg, png, gif" data-validation-error-msg-size="You can not upload images larger than 500kb" data-validation-error-msg-mime="You can only upload images" <?php }?> >
                                            <input type="hidden" name="old_brand_image" <?php if(!empty($slider_row)) { ?> value="<?php echo $slider_row->slider_image; ?>" <?php } ?>>
                                        <?php 
                                                                    if(!empty($slider_row)){
                                                                        if($slider_row->slider_image == NULL || $slider_row->slider_image == "")
                                                                        {
                                                                            $src=base_url()."../uploads/slider/no_image.png";
                                                                        }
                                                                        else
                                                                        {
                                                                            $src = base_url()."../uploads/slider/".$slider_row->slider_image;
                                                                        }
                                                                        ?>
                                                                        <img src="<?php echo $src; ?>" style="height: 50px;">
                                                                        <?php
                                                                    }
                                                                    ?>
                                                                    <?php if(form_error('slider_image') != ""){?>     
                                                            <div style="color:red"><?php echo "Attach Slider image.";?></div>
                                                            <?php } ?>
   
                                        </div>
										
										<div class="form-group">
                                            <label for="exampleInputEmail1">Main Caption</label>
                                            <input type="text" name="main_caption" class="form-control" placeholder="Main Caption" value="<?php if(empty($slider_row)) { echo set_value('main_caption'); } else{ echo $slider_row->main_caption; } ?>" data-validation="required alphanumeric" data-validation-allowing=" " autocomplete="off">
                                            <?php if(form_error('main_caption') != ""){?>     
     <div style="color:red"><?php echo "Enter main caption.";?></div>
       <?php } ?> 
                                        </div>
										
										<div class="form-group">
                                            <label for="exampleInputEmail1">Sub Caption</label>
                                            <input type="text" name="sub_caption" class="form-control" placeholder="Sub Caption" value="<?php if(empty($slider_row)) { echo set_value('sub_caption'); } else{ echo $slider_row->sub_caption; } ?>" data-validation="required alphanumeric" data-validation-allowing=" " autocomplete="off">
                                            <?php if(form_error('sub_caption') != ""){?>     
     <div style="color:red"><?php echo "Enter sub caption.";?></div>
       <?php } ?> 
                                        </div>
          
                                        
                                    </div><!-- /.box-body -->
<div class="box-footer">
    <input type="hidden" name="id" value="<?php if(!empty($slider_row)) { echo $slider_row->id; } ?>">
                                        <button type="submit" class="btn btn-primary">Submit</button>
                                    </div>
                                    
                                
                            </div><!-- /.box -->

                            

                        
                    
                        </div>
                         
                               
                              
                                    
                                    
                                </form>
                            </div><!-- /.box -->

                            

                        </div>
                    
                        </div>
                    </div><!-- /.row -->

                    <!-- top row -->

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
        <script>
        
        $(window).on("beforeunload", function() {
            return "Are you sure? You didn't finish the form!";
        });
        
        $(document).ready(function() {
            $("#myForm").on("submit", function(e) {
                
                $(window).off("beforeunload");
                return true;
            });
        });
        </script>             
                                        
                     
                    
                    
