 <div class="breadcome-area">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                            <div class="breadcome-list single-page-breadcome">
                                <div class="row">
                                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
                                       &nbsp;
                                    </div>
                                    <div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
                                        <ul class="breadcome-menu">
                                            <li><a href="#">Home</a> <span class="bread-slash">/</span>
                                            </li>
                                            <li><span class="bread-blod">Rack</span>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- Basic Form Start -->
        <div class="basic-form-area mg-tb-15">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
                        <div class="sparkline8-list mt-b-30">
                           <?php
						   if($_GET['id'])
							{
							$id=$_GET['id'];
							$sql="select * from rack where id='$id'";
							$r=$this->db->query($sql);
							$rr=$r->result_array();
						//	print_r($rr);
								$name=$rr[0]['name'];
								$rack_number=$rr[0]['rack_number'];
								$size=$rr[0]['size'];
								$datacenter_id=$rr[0]['datacenter_id'];
								
								$sql1="select * from datacenter where id='$datacenter_id'";
							$r1=$this->db->query($sql1);
							$rr1=$r1->result_array();
						//	print_r($rr);
								$dname=$rr1[0]['name'];
								
							?>

						   <div class="sparkline8-hd">
                                <div class="main-sparkline8-hd">
                                    <h1>Edit Rack</h1>
                                </div>
                            </div>
                            <div class="sparkline8-graph">
                                <div class="basic-login-form-ad">
                      
                                    <div class="row">
                                        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                            <div class="basic-login-inner">
                                                <p></p>
                                                <form role="form" action="<?php echo site_url();?>Rack/update_Rack" method="post" role="form" class="form-horizontal">
																								<input type="hidden" name="id" value="<?=$id?>">

													<div class="form-group-inner">
                                                        <label>Rack Number </label>
                                                        <input type="text" name="rack_number" value="<?=$rack_number?>" class="form-control" placeholder="Enter Number of rack" />
                                                    </div>
                                                    <div class="form-group-inner">
                                                        <label>Name</label>
                                                        <input type="text" name="name" value="<?=$name?>" class="form-control" placeholder="Rack Name" />
                                                    </div> 
													<div class="form-group-inner">
                                                        <label>Size</label>
                                                        <select name="size" class="form-control">
														<option value="<?=$size?>"><?=$size?></option>
														<option value="42">42U</option>
														<option value="52">52U</option>
														</select>
                                                    </div>
													<div class="form-group-inner">
                                                        <label>Data Center</label>
                                                        <select name="datacenter_id" class="form-control">
														<option value="<?=$datacenter_id?>"><?=$dname?></option>
														<?php
														foreach($datacenter as $rr4)
														{
														?>
														<option value="<?=$rr4['id']?>"><?=$rr4['name']?></option>
														
														<?php
														}
														?>
														</select>
                                                    </div>
                                                    <div class="login-btn-inner">
                                                        <div class="inline-remember-me">
                                                            <button class="btn btn-sm btn-primary pull-right login-submit-cs" type="submit">Update</button>
                                                          
                                                        </div>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                     
                                    </div>
                                </div>
                            </div>
							<?php
							}
							else
							{
								?>
								 <div class="sparkline8-hd">
                                <div class="main-sparkline8-hd">
                                    <h1>Add New Rack
                            </div>
                            <div class="sparkline8-graph">
                                <div class="basic-login-form-ad">
                      
                                    <div class="row">
                                        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                            <div class="basic-login-inner">
                                                <p></p>
                                                <form role="form" action="<?php echo site_url();?>Rack/save_Rack" method="post" role="form" class="form-horizontal">
                                                    <div class="form-group-inner">
                                                        <label>Rack Number </label>
                                                        <input type="text" name="rack_number" class="form-control" placeholder="Enter Number of rack" />
                                                    </div>
                                                    <div class="form-group-inner">
                                                        <label>Name</label>
                                                        <input type="text" name="name" class="form-control" placeholder="Rack Name" />
                                                   <span style="color: red;"><?php echo form_error('name'); ?></span>
                                                    </div> 
													<div class="form-group-inner">
                                                        <label>Size</label>
                                                        <select name="size" class="form-control">
														<option>-select-</option>
														<option value="42">42U</option>
														<option value="52">52U</option>
														</select>
                                                    </div>
													<div class="form-group-inner">
                                                        <label>Data Center</label>
                                                        <select name="datacenter_id" class="form-control">
														<option>-select-</option>
														<?php
														foreach($datacenter as $rr3)
														{
														?>
														<option value="<?=$rr3['id']?>"><?=$rr3['name']?></option>
														
														<?php
														}
														?>
														</select>
                                                    </div>
                                                    <div class="login-btn-inner">
                                                        <div class="inline-remember-me">
                                                            <button class="btn btn-sm btn-primary pull-right login-submit-cs" type="submit">Submit</button>
                                                          
                                                        </div>
                                                    </div>
                                                </form>
                                            </div>
                                        </div>
                                     
                                    </div>
                                </div>
                            </div>
							</div>
								<?php
							}
							?>
							
                        
                    </div>
                    </div>
                    <div class="col-lg-8 col-md-8 col-sm-8 col-xs-12">
                        <div class="sparkline9-list responsive-mg-b-30">
                            <div class="sparkline9-hd">
                                <div class="main-sparkline9-hd">
                                    <h1>Rack List</h1>
                                </div>
                            </div>
                            <div class="sparkline9-graph">
                                <div class="basic-login-form-ad">
                 
                                    <div class="row">
                                        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                            <div class="basic-login-inner">
                                                <p></p>
            <div style="overflow-x:auto;">
              
     <table id="example1" class="table table-striped table-bordered responsive">
        <thead>
            <tr>
				<th>Rack Number</th>
				<th>Name</th>
				<th>Size</th>
				<th>Data center</th>
				<th>Edit</th>                
				<th>Delete</th>                
            </tr>
        </thead>
        <tbody>
<?php
foreach($rack as $r)
{
	$datacenter_id=$r['datacenter_id'];
								
								$sql1="select * from datacenter where id='$datacenter_id'";
							$r1=$this->db->query($sql1);
							$rr1=$r1->result_array();
						//	print_r($rr);
								$dname=$rr1[0]['name'];
?>				
					<tr class="gradeX">
					<td><?=$r['rack_number']?></td>
					<td><?=$r['name']?></td>
					<td><?=$r['size']?>U</td>
					<td><?=$dname?></td>
					<td><a href="<?php echo site_url();?>Rack/Rack?id=<?php echo $r['id']?>" title="Edit Rack" class=""><i class="fa fa-pencil " aria-hidden="true"></i></td>
					<td><a href="<?php echo site_url();?>Rack/delete_Rack/<?php echo $r['id']?>" title="Delete Rack" class=""><i class="fa fa-trash" aria-hidden="true"></i></td>
					</tr>
			
<?php
}
?>
        </tbody>
    </table>
	</div>

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


            </div>
        </div>
		
			
      <link href="<?php echo site_url();?>assets/css/jquery.dataTables.min.css" rel="stylesheet">
	    <link href="https://cdn.datatables.net/buttons/1.4.2/css/buttons.dataTables.min.css" rel="stylesheet">
    
	<script src="//code.jquery.com/jquery-1.12.4.js"></script> 
	<script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script> 
	<script src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script> 
	<script src="//cdn.datatables.net/buttons/1.4.2/js/buttons.flash.min.js"></script> 
	<script src="//cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script> 
	<script src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script> 
	<script src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script> 
	<script src="//cdn.datatables.net/buttons/1.4.2/js/buttons.html5.min.js"></script> 
	<script src="//cdn.datatables.net/buttons/1.4.2/js/buttons.print.min.js"></script> 
<!-- for datatable csv,pdf.... -->

	<script>
$(document).ready(function() {
    $('#example1').DataTable( {
        dom: 'Bfrtip',
		"pageLength": 10,
        buttons: [
             'csv', 'excel'
        ]
    } );
} );			
	</script>  
		
			
	

