$ip=$_SERVER['HTTP_CLIENT_IP'];
$ins=mysql_query("INSERT INTO smp_result SET point='$option',ip='$ip', tm='$id'");
$prog=mysql_query("SELECT * FROM smp_result WHERE tm='$id' AND ip='$ip'");
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Hidden/Visible Element HTML Menggunakan Javascript</title>
<script type="text/javascript">
function tampil_alamat(param)
{
if(param==1) {
document.getElementById("alamatkantor").style.visibility = 'hidden';
document.getElementById("alamatrumah").style.visibility = 'visible';
}else{
document.getElementById("alamatkantor").style.visibility = 'visible';
document.getElementById("alamatrumah").style.visibility = 'hidden';
}
}
</script>
</head>
<body>
<form name="form_pemesanan" action="#" method="post">
<fieldset title="Data Pengirim" id="templatepengirim">
<legend>Data Pengirim</legend>
<table cellpadding="3px">
<tr>
<td>Nama Pengirim</td>
<td>
<input type="text" name="namapengirim" size="30" /></td>
</tr>
<tr>
<td>Tujuan Pengiriman</td>
<td>
<input type="radio" name="tujuan" value="false" onclick="tampil_alamat(0);" checked />
Alamat Kantor
<label></label>
<br />
<input type="radio" name="tujuan" value="true" onclick="tampil_alamat(1);" />
Alamat Rumah</td>
</tr>
</table>
</fieldset>
<fieldset title="Alamat Pengiriman" id="alamatkantor" style="visibility: visible;">
<legend>Alamat Kantor</legend>
<table cellpadding="3px">
<tr>
<td>Alamat</td>
<td>
<input type="text" name="alamat" size="30" />
</td>
</tr>
<tr>
<td>Kota</td>
<td>
<input type="text" name="kontak" size="30" />
</td>
</tr>
<tr>
<td>Kontak</td>
<td>
<input type="text" name="kontak" size="30" />
</td>
</tr>
</table>
</fieldset>
<fieldset title="Alamat Pengiriman" id="alamatrumah" style="visibility: hidden;">
<legend>Alamat Rumah</legend>
<table cellpadding="3px">
<tr>
<td>Alamat</td>
<td>
<input type="text" name="alamat" size="30" />
</td>
</tr>
<tr>
<td>Kota</td>
<td>
<input type="text" name="kontak" size="30" />
</td>
</tr>
<tr>
<td>Kontak</td>
<td>
<input type="text" name="kontak" size="30" />
</td>
</tr>
</table>
</fieldset>
<fieldset title="Kirim Data" id="templatebutton">
<legend>Kirim Data</legend>
<table cellpadding="3px">
<tr>
<td> </td>
<td>
<input type="submit" name="btn_submit" value="Kirim" />
</td>
</tr>
</table>
</fieldset>
</form>
</body>
</html>
<?
include "config/koneksi.php";
include "config/fungsi.php";
$alamat = "?mod=penilaian";
$aksi = $_GET[aksi];
$tahunsekarang = date("Y");
$jamsekarang = date("H:m:s");
?>
<script src="jquery.ui-1.5.2/jquery-1.2.6.js" type="text/javascript"></script>
<script src="jquery.ui-1.5.2/ui/ui.datepicker.js" type="text/javascript"></script>
<link href="jquery.ui-1.5.2/themes/ui.datepicker.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
function validasi_input(){
function check_radio(radio)
{
// memeriksa apakah radio button sudah ada yang dipilih
for (i = 0; i < radio.length; i++)
{
if (radio[i].checked === true)
{
return radio[i].value;
}
}
return false;
}
var radio_val = check_radio(form.jk);
if (radio_val === false)
{
alert("Anda belum memilih Jenis Kelamin!");
return false;
}
return (true);
}
</script>
<!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=iso-8859-1" />
<title>Penilaian</title>
<link href="config/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
$point = mysql_query("SELECT * FROM t_bobot_nilai");
$d = array();
while($po = mysql_fetch_array($point)){
//print_r($po);
//foreach($po as $p){
//$d[$p[nilai]] = $p[nilai];
//}
$d[$po[id]] = $po[nilai];
}
if (empty($aksi))
{
?>
<form action="proses_penilaian.php?aksi=satu" method="post">
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>Pilih Nama Karyawan</td>
</tr>
<tr>
<td colspan="2" class="error"><? echo $_GET[err]; ?></td>
</tr>
</table>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="bgform" align="center">
<?php if(isset($_GET['nip'])){?>
NIP = <?php echo $_GET['nip'];?>
<?php }else{ ?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class="tabelsorot">
<td width="11%" class="tabelheader">Karyawan</td>
<td width="11%" class="tabelheader"> : </td>
<td width="18%">
<select name="nip" size="1">
<?php
$year = date('Y');
$qkary = mysql_query("select mst_karyawan.* from mst_karyawan order by nama_lengkap")or die (mysql_error());
while ($tkary = mysql_fetch_array($qkary))
{
echo "<option value=$tkary[nip]>$tkary[nip] | $tkary[nama_lengkap]</option>";
}
?>
</select>
</td>
<td width="20%" class="tabelheader">Pemantauan ke</td>
<td width="6%" class="tabelheader"> : </td>
<td width="34%">
<select name="semester" size="1">
<option value="1">1 (Satu)</option>
<option value="2">2 (Dua)</option>
</select>
</td>
</tr>
</table>
<?php } ?>
</td>
</tr>
<?php
$faktor = mysql_query("SELECT * FROM faktor_penilaian WHERE id=1")or die(mysql_error());
$data_faktor = mysql_fetch_array($faktor);
$sql = mysql_query("SELECT * FROM sub_faktor_penilaian WHERE faktor=1")or die(mysql_error());
$bobot = mysql_query("SELECT * FROM t_bobot_nilai");
$jum_nilai = mysql_num_rows($bobot);
//print_r($d);
?>
<tr>
<td class="judul_report">Faktor <?php echo $data_faktor['nama']?></td>
</tr>
<tr>
<td>
<table border="0" align="center" width="69%" class="" bgcolor="#CCCCCC">
<?php
$no=1;
while($data_penilaian = mysql_fetch_array($sql)){?>
<tr>
<td width="16%" valign="top">
<label><?php echo $data_penilaian['sub_faktor']?></label>
<input type="hidden" name="<?php echo "sub_faktor[$no][sub_faktor]" ?>" value="<?php echo $data_penilaian['sub_faktor']?>" />
</td>
<td width="2%"> </td>
<td width="82%">
<?php //while($data_bobot = mysql_fetch_array($bobot)){
for($a=1;$a<=$jum_nilai;$a++){
$data_bobot = mysql_fetch_array($bobot);
//print_r($data_bobot);
?>
<input type="radio" name="<?php echo "$data_penilaian[sub_faktor][sub]"?>" value="<?php echo $d[$a]?>" /><?php echo $d[$a]?><br />
<?php //}
}
?>
</td>
</tr>
<tr><td><hr /></td></tr>
<?php $no++;} ?>
</table>
</td>
</tr>
<tr><td><hr /></td></tr>
<tr><td align="center"><input class="pesan" type="submit" name="submit" value="NEXT >>" onclick="return validasi_input(this)" /></td></tr>
</table>
</form>
<p> </p>
<?
<?php
mysql_connect("localhost","root","");
mysql_select_db("dbgestun");
$result = mysql_query("select * from edc");
$jsArray = "var prdName = new Array();\n";
echo 'Kode EDC : <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['id_edc'] . '</option>';
$jsArray .= "prdName['" . $row['id_edc'] . "'] = {name:'" . addslashes($row['nama_edc']) . "',desc:'".addslashes($row['bankRT_trans'])."'};\n";
}
echo '</select>';
?>
Nama EDC Machine : <input type="text" name="nama_edc" id="nama_edc"/>
Bankrate : <input type="text" name="bankRT_trans" id="bankRT_trans"/>
<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>