<?php
$result = mysql_query("select * from edc");
$jsArray = "var prdName = new Array();\n";
echo '<select name="prdId" onchange="changeValue(this.value)">';
echo '<option>--Silahkan Pilih --</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['id_edc'] . '">' . $row['nama_edc'] . '</option>';
$jsArray .= "prdName['" . $row['id_edc'] . "'] = {name:'" . addslashes($row['nama_edc']) . "',desc:'".addslashes($row['bankRT_trans'])."'};\n";
}
echo '</select>';
?>
<input type="hidden" name="nama_edc" id="nama_edc" />
<input type="hidden" latestvalue="0" onChange="menghitungTransaksi('trans');" id="bankRT_trans" name="bankRT_trans" maxlength="5" size="5" onblur="tCheckNumberPersen(this);">
<script type="text/javascript">
<?php echo $jsArray; ?>
function changeValue(id){
document.getElementById('nama_edc').value = prdName[id].name;
document.getElementById('bankRT_trans').value = prdName[id].desc;
};
</script>
<?php
$koneksi=mysql_connect("localhost","root","") or die (mysql_error());
$pilih_db=mysql_select_db("dbgestun") or die (mysql_error());
$perintah="SELECT * FROM krt_kredit";
$jalankan_perintah=mysql_query($perintah) or die (mysql_error());
$result = mysql_query("select * from krt_kredit");
$jsArray = "var card_type = new Array();\n";
echo '<select name="card_type" onchange="document.getElementById(\'no_credit\').value = card_type[this.value]">';
echo '<option>-------</option>';
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['card_type'] . '">' . $row['card_type'] . '</option>';
$jsArray .= "card_type['" . $row['card_type'] . "'] = '" . addslashes($row['no_credit']) . "';\n";
}
echo '</select>';
?>
Bankrate : <input type="text" name="no_credit" id="no_credit"/>
<script type="text/javascript">
<?php echo $jsArray; ?>
</script>
while ($row = mysql_fetch_array($result)) {
echo '<option value="' . $row['card_type'] . '">' . $row['card_type'] . '</option>';
$jsArray .= "card_type['" . $row['card_type'] . "'] = {card:'" . addslashes($row['no_credit']) . "'};\n";
}
echo '</select>';
?>
Bankrate : <input type="text" name="no_credit" id="no_credit"/>
<script type="text/javascript">
document.getElementById('no_credit').value=card_type[id].card;
</script
<script></script>
<form>
<table id="tab_layout"width="100%">
<tr height="10"></tr>
<tr>
<td style="background-color:white" align="justify">
<table id="tab_data" width="80%">
<?php
include "../config/koneksi.php";
$tablename="log";
// jumlah data perhalaman
$rowsPerPage = 20;
//nilai pertama
$pageNum = 1;
if(!empty($_GET['page']))
{
$pageNum = $_GET['page'];
}
$offset = ($pageNum - 1) * $rowsPerPage;
// query database
$query = "SELECT * FROM $tablename ORDER by tanggal desc LIMIT $offset, $rowsPerPage";
$result = mysql_query($query) or die('Error, query failed. ' . mysql_error());
?>
<th>Pengguna</th>
<th>Aktifitas</th>
<th>Tanggal</th>
</tr>
<?php
while($row = mysql_fetch_array($result))
{
?>
<tr bgcolor="#fff">
<td><center><?php echo $row['pengguna']?></center></td>
<td><?php echo $row['aktifitas']?></td>
<td><center><?php echo $row['tanggal']?></center></td>
</tr>
<?php
} //end of while
?>
</table>
<?php
$query = "SELECT COUNT(tanggal) AS numrows FROM $tablename";
$result = mysql_query($query) or die('Error, query failed. ' . mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$numrows = $row['numrows'];
$maxPage = ceil($numrows/$rowsPerPage);
$nextLink = ' ';
if($maxPage >1)
{
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
$nav .= "<form id=\"FNav\" name=\"FNav\" method=\"get\" action=\"\">";
$nav .= "Halaman : <select name=\"page\" id=\"page\">";
for($page = 1; $page <= $maxPage; $page++)
{
if($pageNum==$page)
{
$nav .= "<option selected>$page</option>";
} else {
$nav .= "<option>$page</option>";
}
}
$nav .= "</select>";
$nav .= "<input type=\"submit\" name=\"btn\" id=\"btn\" value=\"Pilih\" />";
$nav .= "</form>";
}
echo '<p>'.$nav.'</p>';
mysql_free_result($result);
?>
</td>
</tr>
</table>
</form>