codeigniter_test2/application/views/tes/HalamanUtama.php

55 lines
1.6 KiB
PHP
Raw Normal View History

2020-01-02 23:07:40 +07:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $judul; ?></title>
<link href="../../css/barang.css" rel="stylesheet" type="text/css" />
<script>
function myFunction(id)
{
var url="<?php echo base_url();?>";
var r=confirm("Do you want to delete this?");
if (r==true)
{
window.location = url+"index.php/barang_controller/delete/"+id;
}
else
{
return false;
}
}
</script>
</head>
<body class="bg">
<div class="content">
<a href="<?php echo base_url().'index.php/user_controller/logout'; ?>">Logout</a>
<div class="barang">
<h3>Daftar Barang</h3>
<table border="5">
<thead>
<tr>
<th>Nama Barang</th>
<th>Harga</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
foreach($daftar_barang as $barang){
?>
<tr>
<td><?php echo $barang->nama; ?></td>
<td><?php echo $barang->harga; ?></td>
<td><?php echo '<a href="'.base_url().'index.php/barang_controller/edit/'.$barang->id.'"><button id="bt">Edit</button></a>' ?>
<button id="bt" onclick="myFunction(<?php echo $barang->id;?>)">Delete</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</body>
</html>