Monday 30 January 2017

display

<!DOCTYPE html>
<html>
<head>
  <title>View</title>

<script type="text/javascript">
checked=false;
function checkedAll(frm1)
{
var aa=document.getElementById('frm1');
if(checked==false)
{
checked =true
}
else
{
checked =false
}
for(var i=0;i < aa.elements.length;i++)
{
aa.elements[i].checked=checked;
}
}
</script>

</head>
<body>

<form method="post" action="<?php echo base_url();?>emp/search">
<div align="right" class="search">
<input type="text" name="search" placeholder="Username" />
<input type="submit" value="search" />
</div>
</form>

<form method="post" enctype="multipart/form-data" action="<?php echo base_url();?>emp/delete_all
 " id="frm1">

<table>
<tr><a href="<?php echo base_url();?>emp">Insert Data</a></tr>
</table>

<table  border="1" style="background-color:#">
<tr>
 <th><input type="checkbox" name="id[]" onclick="checkedAll(frm1);"/></th>
<td>Id</td>
<td>Username</td>
<td>Password</td>
<td>Address</td>
<td>Contact</td>
<td>Email</td>
<td>gender</td>
<td>Image</td>
<td>city</td>
<td>Hobby</td>
<td colspan="2" align="center">Action</td>
</tr>

<?php
if($result)
{
$no=1;
foreach($result as $row)
{
?>  <tr>
<td><input type="checkbox" name="id[]" value="<?php echo $row->id;?>"></td>
     <td><?php echo $no; $row->id;?></td>
   <td><?php echo $row->username;?></td>
   <td><?php echo $row->password;?></td>
   <td><?php echo $row->address?></td>
   <td><?php echo $row->contact;?></td>
   <td><?php echo $row->email;?></td>
   <td><?php echo $row->gender;?></td>
   <td>
   <?php
     $path=explode(",",$row->images);
 $i=count($path);
 $file_path ='upload/';
 for($j=0;$j<$i;$j++)
 {
    $src=$file_path.$path[$j];
   ?>

 <img src="<?php echo base_url();?>/<?php echo $src;?>" width="50" height="50" title="<?php echo $row->images;?>"/>

<!-- <a href='<?php echo base_url();?>emp/delete_single/<?php echo $src."/".$row->id;?>'>Delete</a>
-->

        <!--     <a href="<?php echo base_url();?>emp/delete_single/<?php echo $row->id;?>/<?php echo $row->images;?>">Delete</a>
         -->

 <a href='<?php echo base_url();?>emp/delete_single/<?php echo $row->id."/".$path[$j];  ?>'>Delete</a>
 
 <?php
 }
    ?>
</td>

   <td><?php echo $row->city;?></td>

 <td><?php echo $row->hobby;?></td>
 
<td>
<a href="<?php echo base_url();?>emp/delete/<?php echo $row->id;?>">Delete</a></td>
 
    <td><a href="<?php echo base_url();?>emp/edit/<?php echo $row->id;?>">Update</a></td>

   </tr>
   <?php
   $no++;
}
}
?>
 <tr><td align="left" colspan="13">
   <input type="submit" value="Delete All" /></td></tr>

</table>

<div class="pgin">
<?php echo $link;?>
</div>
</body>
</html>

No comments:

Post a Comment