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

                    <!-- Small boxes (Stat box) -->
                    <div class="row">
				
						
                                <form role="form" action="<?php echo site_url('aqadmin/add_brands');?>" 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($brand_row))
                                        {
                                            echo "Add brand";
                                        }
                                        else
                                        {
                                            echo "Edit brand";
                                        }
                                        ?>
                                    </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">Brand Name</label>
                                            <input type="text" name="brand_name" class="form-control" placeholder="Brand name" value="<?php if(empty($brand_row)) { echo set_value('brand_name'); } else{ echo $brand_row->brand_name; } ?>" data-validation="required alphanumeric" data-validation-allowing=" " autocomplete="off">
                                            <?php if(form_error('brand_name') != ""){?>     
     <div style="color:red"><?php echo "Enter brand name.";?></div>
       <?php } ?> 
                                        </div>
                                        
                                    
          
            <div class="form-group">
                                            <label for="exampleInputEmail1">Brand Logo</label>
                                            <input type="file" class="form-control" id="inputPassword3" placeholder="Brand Logo" name="brand_logo" <?php if(empty($brand_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_logo" <?php if(!empty($brand_row)) { ?> value="<?php echo $brand_row->brand_logo; ?>" <?php } ?>>
                                        <?php 
                                                                    if(!empty($brand_row)){
                                                                        if($brand_row->brand_logo == NULL || $brand_row->brand_logo == "")
                                                                        {
                                                                            $src=base_url()."../uploads/brand_logo/no_image.png";
                                                                        }
                                                                        else
                                                                        {
                                                                            $src = base_url()."../uploads/brand_logo/thumbs/".$brand_row->brand_logo;
                                                                        }
                                                                        ?>
                                                                        <img src="<?php echo $src; ?>" style="height: 50px;">
                                                                        <?php
                                                                    }
                                                                    ?>
                                                                    <?php if(form_error('brand_logo') != ""){?>     
                                                            <div style="color:red"><?php echo "Enter brand logo.";?></div>
                                                            <?php } ?>
   
                                        </div>
                                        
                                    </div><!-- /.box-body -->
<div class="box-footer">
    <input type="hidden" name="id" value="<?php if(!empty($brand_row)) { echo $brand_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>             
                                        
                     
                    
                    
