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

                    <!-- Small boxes (Stat box) -->
                    <div class="row">
				
						
                                <form role="form" action="<?php echo site_url('aqadmin/add_testimonials');?>" 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($testimonial_row))
                                        {
                                            echo "Add testimonial";
                                        }
                                        else
                                        {
                                            echo "Edit testimonial";
                                        }
                                        ?>
                                    </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">Client</label>
                                            <select name="client_id" class="form-control" onchange="show_name(this.value)">
                                                <?php
                                                $clients=$this->aqadmin_model->select('exp_clients');
                                                foreach($clients as $client)
                                                {
                                                    ?>
                                                    <option value="<?php echo $client->id; ?>" <?php if(!empty($testimonial_row)) { if($testimonial_row->client_id==$client->id) { ?> selected="selected"  <?php } } ?>><?php echo $client->client_name; ?></option>
                                                    <?php
                                                }
                                                ?>
                                                <option value="0" <?php if(!empty($testimonial_row)) { if($testimonial_row->client_id==0) { ?> selected="selected"  <?php } } ?>>Other</option>
                                                
                                            </select>
                                            
       
                                        </div>
                                    <div class="form-group" id="client_other" <?php if(!empty($testimonial_row)) { if($testimonial_row->client_id!=0) { ?> style="display: none;" <?php } } else { ?> style="display: none;" <?php } ?>>
                                            <label for="exampleInputEmail1">Name</label>
                                            <input type="text" name="name" class="form-control" placeholder="Enter name" value="<?php if(empty($testimonial_row)) { echo set_value('name'); } else{ echo $testimonial_row->name; } ?>" data-validation="alphanumeric" data-validation-allowing=" " autocomplete="off">
                                            <?php if(form_error('name') != ""){?>     
     <div style="color:red"><?php echo "Enter the name.";?></div>
       <?php } ?> 
                                        </div>
                                        
                                    
           <div class="form-group location">
                                            <label for="exampleInputEmail1">Location</label>
                                            <input type="text" class="form-control geocomplete" id="inputPassword3" placeholder="Location" name="loc" data-validation="required length" data-validation-length="min2" data-validation-allowing=" ," autocomplete="off" value="<?php if(empty($testimonial_row)) { echo set_value('loc'); } else{ echo $testimonial_row->location; } ?>">
    
    <fieldset class="details">
      <input name="lat" type="hidden" class="form-control" value="">
      <input name="lng" type="hidden" class="form-control" value="">
    </fieldset>
                                            <?php if(form_error('loc') != ""){?>     
     <div style="color:red"><?php echo "Enter location.";?></div>
       <?php } ?> 
                                        </div>
                                        <div class="form-group">
                                            <label for="exampleInputEmail1">Testimonial</label>
                                            <textarea name="testimonial" class="form-control" data-validation="required" autocomplete="off" value="<?php if(empty($testimonial_row)) { echo set_value('testimonial'); } else{ echo $testimonial_row->testimonial; } ?>"><?php if(empty($testimonial_row)) { echo set_value('testimonial'); } else{ echo $testimonial_row->testimonial; } ?></textarea>
                                                   <?php if(form_error('testimonial') != ""){?>     
     <div style="color:red"><?php echo "Enter testimonial.";?></div>
       <?php } ?>
                                        </div>
                                        
                                    </div><!-- /.box-body -->
<div class="box-footer">
    <input type="hidden" name="id" value="<?php if(!empty($testimonial_row)) { echo $testimonial_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;
            });
        });
        function show_name(val)
        {
            if(val==0)
            {
                $("#client_other").show();
            }
            else
            {
                $("#client_other").hide();
            }
        }
        </script>             
                                        
                     
                    
                    
