bli mau tanya add recordku knpa g bisa ya...ini scripnya
<?php
session_start();
include "../main_function.php";
?>
<!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>Equity Indonesia</title>
<link rel="stylesheet" type="text/css" href="../css/accordion_glam.css" />
<link rel="stylesheet" type="text/css" href="../css/style3.css" />
<style type="text/css">
<!--
.style1 {color: #669; height:26px; width:200px; font-size:16px;}
-->
</style>
<Script type="text/javascript">
function addRowToTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
// if there's no header row in the table, then iteration = lastRow + 1
var iteration = lastRow;
var row = tbl.insertRow(lastRow);
// left cell
var cellLeft = row.insertCell(0);
var textNode = document.createTextNode(iteration);
cellLeft.appendChild(textNode);
// right cell
var cellRight = row.insertCell(1);
var el = document.createElement('input');
el.type = 'text';
el.name = 'txtRow' + iteration;
el.id = 'txtRow' + iteration;
el.size = 40;
el.onkeypress = keyPressTest;
cellRight.appendChild(el);
}
function keyPressTest(e, obj)
{
var validateChkb = document.getElementById('chkValidateOnKeyPress');
if (validateChkb.checked) {
var displayObj = document.getElementById('spanOutput');
var key;
if(window.event) {
key = window.event.keyCode;
}
else if(e.which) {
key = e.which;
}
var objId;
if (obj != null) {
objId = obj.id;
} else {
objId = this.id;
}
displayObj.innerHTML = objId + ' : ' + String.fromCharCode(key);
}
}
function removeRowFromTable()
{
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length;
if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
function openInNewWindow(frm)
{
// open a blank window
var aWindow = window.open('', 'TableAddRowNewWindow',
'scrollbars=yes,menubar=yes,resizable=yes,toolbar=no,width=400,height=400');
// set the target to the blank window
frm.target = 'TableAddRowNewWindow';
// submit
frm.submit();
}
function validateRow(frm)
{
var chkb = document.getElementById('chkValidate');
if (chkb.checked) {
var tbl = document.getElementById('tblSample');
var lastRow = tbl.rows.length - 1;
var i;
for (i=1; i<=lastRow; i++) {
var aRow = document.getElementById('txtRow' + i);
if (aRow.value.length <= 0) {
alert('Row ' + i + ' is empty');
return;
}
}
}
openInNewWindow(frm);
}
</Script>
</head>
<body>
<div id="header">
<div class="shell"><div class="logo"> <img src="../images/Logo-Equity.png" align="left" height="95"/></div>
<div class="right_header"></div>
</div></div>
<br />
<div id="main_container">
<div class="main_content">
<br /> <br />
<div class="center_content">
<div class="left_content">
<div class="sidebarmenu">
<a class="menuitem" href="index.php">Admin Panel</a>
<?php
if (isset($_GET['update']))
{
?><a class="menuitem" href="?update=yes">Update</a><?php
$a = 1;
$kategori=mysql_query("select * from tb_kategori");
while ($data=mysql_fetch_array($kategori))
{
?>
<a class="menuitem" href="?idp=<?php echo $_GET['idp'];?>&id=<?php echo $data['ID_kategori']; ?>&update=yes"><?php echo $data['kategori']; ?></a>
<?php
$a++;
}
}
else
{
?> <a class="menuitem" href="?update=yes">Update</a> <?php
}
?>
<a class="menuitem" href="index.php">Add Kategori</a>
</div>
</div>
<div class="right_content">
<form id="form1" name="form1" method="post" action="save.php?id=<?php echo $_GET['id']; ?>">
<h2><br />
<?php if (isset($_GET['id']))
{
$kategori=mysql_query("select * from tb_kategori where ID_kategori='".$_GET['id']."'");
while($data=mysql_fetch_array($kategori)){
echo 'Kategori : <input type="text" name="kategori" value="" />'; }
}
else
{echo 'Kategori : Silahkan Pilih Kategori !!';
}
?>
</h2>
<table id="rounded-corner" width="850" border="0" >
<thead>
<tr align="center" valign="middle">
<th width="50" align="center" valign="middle" class="rounded-company">No</th>
<th width="565" align="left" class="rounded">Sub Kategori</th>
</tr></thead>
<tfoot>
</tfoot>
<?php
if (isset($_GET['id']))
{
?>
<tbody>
<?php
$idp = $_GET['idp'];
$id=$_GET['id'];
$i = 1;
$kategori=mysql_query("select * from tb_kategori INNER JOIN tb_subkategori ON tb_kategori.ID_kategori=tb_subkategori.ID_kategori
WHERE tb_kategori.ID_kategori='".$id."' ORDER BY tb_kategori.ID_kategori");
while ($data=mysql_fetch_array($kategori))
{
$hasil=mysql_query("select * from tb_hasil where ID_preset= '".$idp."' and ID_kategori= '".$id."' and
ID_sub_kategori='".$data['ID_sub_kategori']."'");
$datacek=mysql_fetch_array($hasil);
?>
<tr align="center" valign="middle" >
<td width="50"><?php echo $i; ?></td>
<td width="565" align="left"><input type="text" name="txtRow1"
size="40" onkeypress="keyPressTest(event, this);" value="<?php echo $data["sub_kategori"]; ?>" /></td>
<input type="hidden" name="ID_kategori" value="<?php echo $data["ID_kategori"]; ?>"/>
<input type="hidden" name="kategori" value="<?php echo $data["kategori"]; ?>"/>
<input type="hidden" name="ID_skategori" value="<?php echo $data["ID_sub_kategori"]; ?>"/>
</tr>
</tbody>
<?php
$i++;
?><input type="hidden" name="n" value="<?php echo $i; ?>"/><?php
}
}
else
{
?>
<tbody>
<tr align="center" valign="middle" >
<td width="50"></td>
<td width="565" align="left"><input type="text" name="txtRow1"
size="40" onkeypress="keyPressTest(event, this);" value="" /></td>
</tr>
</tbody>
<?php
}
?>
</table>
<input type="submit" name="button" class="buttonbt_blue" value="Save" />
<input type="button" value="Remove" class="buttonbt_blue" onclick="removeRowFromTable();" />
<input type="button" value="Add" class="buttonbt_blue" onclick="addRowToTable();" />
</form>
<h2></h2>
<h2> </h2>
</div>
<!-- end of right content-->
</div> <!--end of center content -->
<div class="clear"></div>
</div> <!--end of main content-->
<div class="footer"></div>
</div>
<body>
<br />
</html>