 <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">IPAddress</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">
                							    <script type="text/javascript">
function personalia_showform(obj){
	var no_of_vehicle = obj.value;
	var pers_gesl = obj.value;
<?php echo "window.location.href='IPAddress?cat=' +pers_gesl";?>
}
</script>    
                    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
		
                        <div class="sparkline9-list responsive-mg-b-30">
									
                            <div class="sparkline9-hd">
										<div class="form-group-inner col-md-4 col-md-offset-3">
                                                        <label>Data Center</label>
                                                        <select required onchange="personalia_showform(this);" name="datacenter_id" class="form-control">
														<?php
													if($_GET['cat'])
													{
														$cat=$_GET['cat'];
														
														$sql="select * from datacenter where id='$cat'";
														$r=$this->db->query($sql);
														$rr=$r->result_array();
													//	print_r($rr);
															$name=$rr[0]['name'];
														?>
														<option value="<?=$cat?>"><?=$name?></option>
													<?php
													}
													else
													{
														?>
														<option value="">Select Datacenter</option>
														<?php
													}
													
														
														foreach($datacenter as $rr4)
														{
														?>
														<option value="<?=$rr4['id']?>"><?=$rr4['name']?></option>
														
														<?php
														}
														?>
														</select>
                                                    </div>
													<br /><br /><br /><br />
													<?php
													if($_GET['cat'])
													{
														$cat=$_GET['cat'];
														
														$sql="select * from datacenter where id='$cat'";
														$r=$this->db->query($sql);
														$rr=$r->result_array();
													//	print_r($rr);
															$name=$rr[0]['name'];
															$no_of_ip=$rr[0]['no_of_ip'];
								
														if($_GET['id'])
														{
													?>
							
                                <div class="main-sparkline9-hd">
                                    <h1> </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>
												 <form role="form" action="<?php echo site_url();?>IPAddress/save_IPAddress" method="post" role="form" class="form-horizontal">
												 <input type="hidden" value="<?=$cat?>" name="datacenter_id">
            <div style="overflow-x:hidden;">
              
     <table id="example2" class="table responsive">
        <thead>
            <tr>
				<th>Name</th>
				<th>Static ip<font color="red">*</font></th>
				<th>Ending ip</th>
				<th>Gatewary</th>
            </tr>
        </thead>
        <tbody>
<?php
$sql1="select count(*) as count from ipaddress where datacenter_id='$cat'";
$r1=$this->db->query($sql1);
$rr1=$r1->result_array();
$count=$rr1[0]['count'];
$ft=$no_of_ip-$count;

for($i=0;$i<$ft;$i++)
{
								
							
?>				
					<tr class="gradeX">
					<td><input type="text" name="name[]" class="form-control" size="15"></td>
					<td><input type="text" name="static_ip[]" class="form-control" size="15"></td>
					<td><input type="text" name="ending_ip[]" class="form-control" size="15"></td>
					<td><input type="text" name="gateway[]" class="form-control" size="15"></td>
					
					
					</tr>
			
<?php
}
?>
        </tbody>
    </table>
	</div>
	<br />
	 <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>
           	<?php
			}
				
			else
			{
				
				$cat=$_GET['cat'];
														
				$sql="select * from datacenter where id='$cat'";
				$r=$this->db->query($sql);
				$rr=$r->result_array();
			//	print_r($rr);
					$name=$rr[0]['name'];
					$no_of_ip=$rr[0]['no_of_ip'];
				//	echo $no_of_ip; 
					
				$sql13="select count(*) as count from ipaddress where datacenter_id='$cat'";
				$r13=$this->db->query($sql13);
				$rr13=$r13->result_array();
				$count3=$rr13[0]['count'];
				//echo $count3;
				
				
	
				if($no_of_ip > $count3)
				{
				//	echo '242';
			?>
				<a href="<?php echo site_url();?>IPAddress/IPAddress?cat=<?php echo $cat?>&id=1" class="">ADD New IPAddress</a>
				<?php
				}
				else
				{
				//	echo '444';
					?>
					ADD New IPAddress
					<?php
				}
			//	exit;
				?>
				
                                <div class="main-sparkline9-hd">
                                    <h1> </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 style="width:2%">Sr.No</th>
				<th style="width:20%">Name</th>
				<th style="width:20%">Static ip</th>
				<th style="width:20%">Ending ip</th>
				<th style="width:20%">Gatewary</th>
            </tr>
        </thead>
        <tbody>
<?php
$i=1;
foreach($IPAddress as $r)
{
								
							
?>				
					<tr class="gradeX">
					<td><?=$i?></td>
<td>
<?php
				if($_GET['rid']==$r['id'] && $_GET['edit']=='name')
				{
					$cat=$_GET['cat'];
					?>
					<form action="<?php echo site_url();?>IPAddress/update_name" method="post">
						<input type="text" value="<?=$r['name']?>" class="form-control" size="15" name="name">
						<input type="hidden" name="datacenter_id" value="<?=$cat?>">
						<input type="hidden" name="id" value="<?=$r['id']?>">
						<input type="submit" name="save" value="save" size="2">
					</form>
				<?php
				}
				else
				{
					?>
					<div class="container">
				 <?=$r['name']?>
				  <div class="overlay">
				  <a href="IPAddress?rid=<?=$r['id']?>&edit=name&cat=<?=$cat?>" class="icon1" title="User Profile">
					<i class="fa fa-pencil"></i>
				  </a>
				  </div>
				</div>
					<?php
				}
				?>
</td>	
<td>
<?php
				if($_GET['rid']==$r['id'] && $_GET['edit']=='static_ip')
				{   
					$cat=$_GET['cat'];
					?>
					<form action="<?php echo site_url();?>IPAddress/update_static_ip" method="post">
						<input type="text" value="<?=$r['static_ip']?>" class="form-control" size="15" name="static_ip">
						<input type="hidden" name="datacenter_id" value="<?=$cat?>">
						<input type="hidden" name="id" value="<?=$r['id']?>">
						<input type="submit" name="save" value="save" size="2">
					</form>
				<?php
				}
				else
				{
					?>
					<div class="container">
				 <?=$r['static_ip']?>
				  <div class="overlay">
				  <a href="IPAddress?rid=<?=$r['id']?>&edit=static_ip&cat=<?=$cat?>" class="icon1" title="User Profile">
					<i class="fa fa-pencil"></i>
				  </a>
				  </div>
				</div>
					<?php
				}
				?>
</td>		
	<td>
<?php
				if($_GET['rid']==$r['id'] && $_GET['edit']=='ending_ip')
				{
					?>
					<form action="<?php echo site_url();?>IPAddress/update_ending_ip" method="post">
						<input type="text" value="<?=$r['ending_ip']?>" class="form-control" size="15" name="ending_ip">
						<input type="hidden" name="datacenter_id" value="<?=$cat?>">
						<input type="hidden" name="id" value="<?=$r['id']?>">
						<input type="submit" name="save" value="save" size="2">
					</form>
				<?php
				}
				else
				{
					?>
					<div class="container">
				 <?=$r['ending_ip']?>
				  <div class="overlay">
				  <a href="IPAddress?rid=<?=$r['id']?>&edit=ending_ip&cat=<?=$cat?>" class="icon1" title="User Profile">
					<i class="fa fa-pencil"></i>
				  </a>
				  </div>
				</div>
					<?php
				}
				?>
</td>		
	<td>
				
<?php
				if($_GET['rid']==$r['id'] && $_GET['edit']=='gateway')
				{
					?>
					<form action="<?php echo site_url();?>IPAddress/update_gateway" method="post">
						<input type="text" value="<?=$r['gateway']?>" class="form-control" size="15" name="gateway">
						<input type="hidden" name="datacenter_id" value="<?=$cat?>">
						<input type="hidden" name="id" value="<?=$r['id']?>">
						<input type="submit" name="save" value="save" size="2">
					</form>
				<?php
				}
				else
				{
					?>
					<div class="container">
				 <?=$r['gateway']?>
				  <div class="overlay">
				  <a href="IPAddress?rid=<?=$r['id']?>&edit=gateway&cat=<?=$cat?>" class="icon1" title="User Profile">
					<i class="fa fa-pencil"></i>
				  </a>
				  </div>
				</div>
					<?php
				}
				?>
</td>
					
					</tr>
			
<?php
$i++;
}
?>
        </tbody>
    </table>
	</div>

           	<?php
			
			}
							
			}
			?>
													</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',
		"paging": false,
        buttons: [
             'csv', 'excel'
        ]
    } );
} );			
	</script> 
	<script>
$(document).ready(function() {
    $('#example2').DataTable( {
		searching: false, paging: false, info: false
    } );
} );			
	</script>  
		
			
	<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.container {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.image {
  display: block;
  width: 100%;
  height: auto;
}

.overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  width: 100%;
  opacity: 0;
  transition: .3s ease;
  
}

.container:hover .overlay {
  opacity: 1;
}

.icon1 {
  color: blue;
  font-size: 20px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  text-align: right;
}

.fa-pencil:hover {
  color: blue;
}
</style>
</head>



