Mas saya ada membuat sistem penilaian, dimana saya menggunakan radio button untuk menilai dengan nilai antara 1 s/d 5. Nah radio button yang saya gunakan adalah penggulangan karena ada 3 kategori penilaian. Misal belum dipilih nilai untuk salah satu kategori penilaian akan ada pesan peringatan ketika tombol next di tekan. Tapi ini malah tetap aja bisa lanjut.
<?
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>
<?