[ Mini Kiebo ]
Server: Windows NT DESKTOP-5B8S0D4 6.2 build 9200 (Windows 8 Professional Edition) i586
Path:
D:
/
Backup
/
14082024
/
Data
/
htdocs
/
htdocs
/
simpeg
/
administrator
/
[
Home
]
File: jt_e.php
<?php require_once("../lib/konek.php"); require_once("../lib/konfigurasi_semua.php"); //konfigurasi nama file $thisForm = "view.php"; $actionForm = "action.php"; //actionnya if($_POST["jp_id"]) $jpId = $_POST["jp_id"]; if($_POST["mode"]) $mode = $_POST["mode"]; if($_GET["mode"]) { $mode = "edit"; } if($_GET["id"]) { $jpId = $_GET["id"]; $sql = "select * from hrd_jenis_pekerjaan where jp_id = ".$jpId; $qId = mysql_query($sql); $dataUser = mysql_fetch_array($qId); $_POST["jp_id"] = $dataUser["jp_id"]; $_POST["jp_nama"] = $dataUser["jp_nama"]; } if($_POST["btnSimpan"] || $_POST["btnUpdate"] || $_POST["btnApply"] || $_POST["btnApply2"]) { if($_POST["btnSimpan"] || $_POST["btnApply"]) { $sql = "select jp_id from hrd_jenis_pekerjaan where jp_nama = '".$_POST["jp_nama"]."'"; } if($_POST["btnUpdate"] || $_POST["btnApply2"]) { $sql = "select jp_id from hrd_jenis_pekerjaan where jp_id <> ".$_POST["jp_id"]." and jp_nama = '".$_POST["jp_nama"]."'"; } $Qrs_cek = mysql_query($sql); $datacek = mysql_fetch_array($Qrs_cek); if($datacek) $hint[0] = "Kode ".$_POST["jp_nama"]." sudah ada"; if(!$_POST["jp_nama"]) { $stat_err = true; } if(!$datacek && $stat_err!=true) { if($_POST["btnSimpan"] || $_POST["btnApply"]) { $sql = "select max(jp_id) as id from hrd_jenis_pekerjaan"; $Qrs = mysql_query($sql); $id = mysql_fetch_array($Qrs); $jpId = $id["id"]+1; } if($_POST["btnUpdate"] || $_POST["btnApply2"]) { $jpId = $_POST["jp_id"]; } $nmTable = "hrd_jenis_pekerjaan"; $tbField[0] = "jp_id"; $tbField[1] = "jp_nama"; $tbIsi[0] = $jpId; $tbIsi[1] = "'".$_POST["jp_nama"]."'"; if($_POST["btnSimpan"] || $_POST["btnApply"]) { for($start=0, $jumField=count($tbField); $start<$jumField; $start++) { if($start!=0) { $nmField = $nmField.",".$tbField[$start]; }else{ $nmField = $tbField[$start]; } } for($start=0, $jumIsi=count($tbIsi); $start<$jumIsi; $start++) { if($start!=0) { $isiField = $isiField.",".$tbIsi[$start]; }else{ $isiField = $tbIsi[$start]; } } $sql = "insert ".$nmTable." (".$nmField.") values(".$isiField.")"; } if($_POST["btnUpdate"] || $_POST["btnApply2"]) { for($start=0, $end=count($tbIsi); $start<$end; $start++) { if($start!=0) { $isiField = $isiField.",".$tbField[$start]."=".$tbIsi[$start]; }else{ $isiField = $tbField[$start]."=".$tbIsi[$start]; } } $sql = "update ".$nmTable." set ".$isiField." where ".$tbField[0]." = ".$tbIsi[0]; } $Qrs = mysql_query($sql); //echo $sql; if($Qrs) { $mode = "edit"; } if($_POST["btnSimpan"] || $_POST["btnUpdate"]) { header("location:jt_v.php"); }else{ $_POST["jp_id"] = $jpId; } } } if($_POST["btnKembali"]) { header("location:jt_v.php"); } //end ?> <html> <head> <title><?php echo $header;?></title> </head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" type="text/css" href="../lib/lib-style.css"> <script language="JavaScript" type="text/javascript" src="../lib/ew.js"></script> <script language="JavaScript" type="text/javascript" src="../lib/func_curr.js"></script> <script language="JavaScript" type="text/javascript" src="../lib/elements.js"></script> <body> <form name="frmEdit" method="POST" action="jt_e.php"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td colspan="2" align="left" valign="middle" bgcolor="#000000" height="28"> <font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="white"> <?php echo $header;?></font> </td> </tr> <tr> <td colspan="2" align="left" bgcolor="#DEDBE7" height="20"> <?php include("menu_atas.php"); ?> </td> </tr> <tr> <td colspan="2"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr background="<?php echo $dir_img;?>/background.jpg" valign="middle" height="50"> <td height="50" width="10"> </td> <td height="50" width="300"> </td> <td height="50" width="100"> </td> <td> <?php echo $defFont;?> </font> </td> <td height="50" width="5"> </td> <td height="50" width="48" align="center"> <input type="image" name="btnKembali" value="btnKembali" src="<?php echo $dir_img;?>/cancel_f2.png"> </td> <td height="50" width="5"> </td> <td height="50" width="48" align="center"> <input type="image" name="<?php if($mode=="edit") { ?>btnApply2<?php }else{ ?>btnApply<?php } ?>" value="<?php if($mode=="edit") { ?>btnApply2<?php }else{ ?>btnApply<?php } ?>" src="<?php echo $dir_img;?>/apply_f2.png"> </td> <td height="50" width="5"> </td> <td height="50" width="50" align="center"> <input type="image" name="<?php if($mode=="edit") { ?>btnUpdate<?php }else{ ?>btnSimpan<?php } ?>" value="<?php if($mode=="edit") { ?>btnUpdate<?php }else{ ?>btnSimpan<?php } ?>" src="<?php echo $dir_img;?>/save_f2.png"> </td> </tr> <tr bgcolor="#FFF8DC" valign="middle"> <td width="10"> </td> <td width="300"> </td> <td width="100"> </td> <td> </td> <td width="5"> </td> <td width="48" align="center" onmouseover="this.style.backgroundColor='#FF6666'" onmouseout="this.style.backgroundColor='#FFF8DC'"> <?php echo $defFont;?>Batal</font> </td> <td width="5"> </td> <td width="48" align="center" onmouseover="this.style.backgroundColor='#FF6666'" onmouseout="this.style.backgroundColor='#FFF8DC'"> <?php echo $defFont;?>Apply</font> </td> <td width="5"> </td> <td width="50" align="center" onmouseover="this.style.backgroundColor='#FF6666'" onmouseout="this.style.backgroundColor='#FFF8DC'"> <?php echo $defFont;?>Simpan</font> </td> </tr> </table> </td> </tr> </table> <table border="0" cellspacing="0" cellpadding="0" width="100%" align="left"> <tr bgcolor="#FFF8DC"> <td align="right" width="35%"><?php echo $defFont;?>Jenis Tasklist <?php echo $tFont;?></td> <td width="65%"> <input size="35" maxlength="255" type="teks" name="jp_nama" value="<?php echo $_POST["jp_nama"];?>" class="textField" onKeyDown="return tabOnEnter_select(this, event);"> <input type="hidden" name="jp_id" value="<?php echo $_POST["jp_id"];?>"> <input type="hidden" name="mode" value="<?php echo $mode;?>"> <?php if(!$_POST["jp_nama"]) echo "*";?> </td> </tr> <tr bgcolor="#FFF8DC"> <td align="right"><?php echo $defFont;?> <?php echo $tFont;?></td> <td> </td> </tr> <tr> <td colspan="2"> <font color="yellow"> <?php if($stat_err==true || $hint) echo "Periksa lagi inputan yang bertanda (*)";?><br> <?php if($stat_err==true) echo "<i>Ada field yang belum terisi. Silahkan mengisi terlebih dahulu</i><br>";?> <?php for($start=0, $end=count($hint); $start<$end; $start++) {?> <i><?php echo $defFont;?><?php echo $hint[$start];?> <?php echo $tFont;?></i> <?php } ?> <?php echo $tFont;?> </td> </tr> </table> </form> </body> </html>