mas mau tanya cara simpan kombinasi combobox dengan cekbox trs di kasih dengan textbox gmna ya,,
<?php //===========CODE DELETE RECORD ================
require_once ('Pakar/otentifikasi_pakar.php');
require_once ('inc/koneksi.php');
$act=$_GET['act'];
$KD_PENYAKIT = $_GET['KD_PENYAKIT'];
if ($act=="relasi"){
?>
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<div class="text_area" align="justify">
<div class="art-PostContent"><div class="art-BlockHeader">
<div class="l"></div>
<div class="r"></div>
<div class="art-header-tag-icon">
<div class="t">
<div align="center">Pengolahan Data Relasi</div>
</div>
</div>
</div>
</div>
<br />
<form method="post" action="?page=9&act=tampil">
<table width="100%" align="center" cellpadding="5">
<tr>
<td>
<select name="CmbPenyakit" id="jumpMenu" class="cmblog">
<option value=""> [ Daftar Penyakit ]
</option>
<?php
$query="SELECT * from PENYAKIT order by KD_PENYAKIT";
$parsesql = oci_parse($conn, $query);
oci_execute($parsesql) or die(oci_error());
while ($datap=oci_fetch_array($parsesql)) {
// Untuk Buat Nilai Terpilih
if ($datap['KD_PENYAKIT']==$KD_PENYAKIT) {
$cek = "selected";
}
else {
$cek ="";
}
echo "<option value='$datap[KD_PENYAKIT]'$cek>
$datap[PENYAKIT]</option>";
}
?>
</select>
<input type="hidden" name="KD_PENYAKIT" value="<?php echo $KD_PENYAKIT;?>" /></td>
</tr>
<br>
<tr>
<td></td>
</tr>
<tr>
<td colspan="3"><hr color="#AAAAAA"></td>
</tr>
<tr>
<tD>
<input type="submit" name="Submit" class="btn"value="Tampil"><a href='?page=9&act=berhasil&KD_PENYAKIT'><img src="images/data-add-icon.png" width="30" height="30" title="Tambah Data Gejala"></a>Tambah</td>
</tr>
</table>
</form>
</div>
<?php
}
elseif ($act=="tampil"){
$KP = $_POST['CmbPenyakit'];
$KD_PENYAKIT = $_GET['KD_PENYAKIT'];
?>
<?php
$query="SELECT * FROM PENYAKIT WHERE KD_PENYAKIT='$KP'";
$parsesql = oci_parse($conn, $query);
oci_execute($parsesql) or die(oci_error());
while ($datap=oci_fetch_array($parsesql)){
$sakit= $datap['PENYAKIT'];
?>
<div class="art-PostContent"><div class="art-BlockHeader">
<div class="l"></div>
<div class="r"></div>
<div class="art-header-tag-icon">
<div class="t">
<div align="center">Daftar Gejala Dari Penyakit <?php echo $sakit;?></div>
</div>
</div>
</div>
<?php
}?>
</div>
<br /></br>
<form action="" method="post">
<table width="100%" border="0" cellpadding="2" cellspacing="1" id="table">
<tr>
<tr >
<th width="21" align="center"><b>No</b></th>
<th width="47"><b>Kode Gejala</b></th>
<th width="316">
<b>Nama Gejala</b></th>
<th width="31"><b>Nilai MB</b></th>
<th width="31"><b>Nilai MD</b></th>
<th width="31"><b>Nilai CF</b></th>
</tr>
<?php
$query= "SELECT
RELASI.KD_PENYAKIT,
RELASI.NO_RELASI,
RELASI.MB,
RELASI.MD,
RELASI.CF,
GEJALA.KD_GEJALA,
GEJALA.GEJALA
FROM RELASI JOIN GEJALA ON RELASI.KD_GEJALA = GEJALA.KD_GEJALA JOIN PENYAKIT ON RELASI.KD_PENYAKIT = PENYAKIT.KD_PENYAKIT WHERE KD_PENYAKIT='$KP'";
$parsesql = oci_parse($conn, $query);
oci_execute($parsesql) or die(oci_error());
while($rows=oci_fetch_object($parsesql)){
$no++;
?>
<tr>
<td height="25"><?php echo $posisi+$no ?></td>
<td height="25"><?php echo $rows-> KD_GEJALA;?></td>
<td height="25"><?php echo $rows ->GEJALA;?></td>
<td><?php echo $rows ->MB;?></td>
<td><?php echo $rows ->MD;?></td>
<td><?php echo $rows ->CF;?></td>
</tr>
<?php
}
?>
</table>
<input type="button" name="batal" value="Kembali" class="btn" onClick="javascript:history.go(-1)" />
</form>
<?php
}
if($act=="berhasil"){
$KD_PENYAKIT = $_GET['KD_PENYAKIT'];
$NO_RELASI =$_GET['NO_RELASI'];
?>
<script type="text/javascript">
function hit()
{
var b1 = parseFloat (document.forms.relasi.MB.value);
if (isNaN (b1))
b1=0.0;
var b2 = parseFloat (document.forms.relasi.MD.value);
if (isNaN (b2))
b2=0.0;
var b3 = parseFloat (document.forms.relasi.CF.value);
if (isNaN (b3))
b3=0.0;
document.forms.relasi.CF.value = (b1-b2);
}
</script>
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<div class="text_area" align="justify">
<div class="art-PostContent"><div class="art-BlockHeader">
<div class="l"></div>
<div class="r"></div>
<div class="art-header-tag-icon">
<div class="t">
<div align="center">Pengolahan Data Relasi</div>
</div>
</div>
</div>
</div>
<br />
<form method="post" name="relasi" action="?page=9&act=simpanrelasi">
<table width="100%" align="center" cellpadding="5">
<tr>
<td colspan="5"><hr color="#AAAAAA"></td>
</tr>
<tr>
<td colspan="3" class="subtitle">Nama Penyakit</td>
</tr>
<tr>
<td colspan="3">
<select name="jumpMenu" id="jumpMenu" class="cmblog" onChange="MM_jumpMenu('parent',this,0)">
<option value="?page=9&act=berhasil&KD_PENYAKIT">[ Daftar Penyakit ]</option>
<?php
$query="SELECT * from PENYAKIT order by KD_PENYAKIT";
$parsesql = oci_parse($conn, $query);
oci_execute($parsesql) or die(oci_error());
while ($datap=oci_fetch_array($parsesql)) {
// Untuk Buat Nilai Terpilih
if ($datap['KD_PENYAKIT']==$KD_PENYAKIT) {
$cek = "selected";
}
else {
$cek ="";
}
echo "<option value='?page=9&act=berhasil&KD_PENYAKIT=$datap[KD_PENYAKIT]' $cek>$datap[PENYAKIT]</option>";
}
?>
</select>
<input type="hidden" name="KD_PENYAKIT" value="<?php echo $KD_PENYAKIT;?>" /></td>
</tr>
<br>
<tr>
<td width="68%"></td>
<td width="15%"></td>
<td width="17%"></td>
</tr>
<tr>
<td colspan="5"><hr color="#AAAAAA"></td>
</tr>
<tr>
<td class="subtitle">Daftar Gejala</td>
<td colspan="2" class="subtitle" align="center">Nilai MB, MD dan CF</td>
</tr>
<?php
$no=0;
$query = "SELECT * FROM GEJALA ORDER BY KD_GEJALA";
$parsesql = oci_parse($conn, $query);
oci_execute($parsesql) or die(oci_error());
while ($data=oci_fetch_array($parsesql)) {
$no++;
?>
<tr>
<td>
<input name="cekgejala[]" type="checkbox" value="<?php echo $data['KD_GEJALA'];?>" <?php echo $cek;?> /> <?php echo "[".$data['KD_GEJALA']."] ".$data['GEJALA'];?></td>
<td>
<input type="text" style="width:30px" name="MB" class ="nilai" id="MB" /></td>
<td><label for="MD"></label>
<input type="text" style="width:30px"name="MD" class ="nilai" id="MD" /></td>
<td><label for="CF"></label>
<input type="text" style="width:30px" name="CF" class ="nilai" id="CF" /></td>
</tr>
<?php }?>
<tr><td></td>
<td></td>
<td></td>
</tr>
<tr>
<td colspan="5"><hr color="#AAAAAA"></td>
</tr>
<tr>
<td colspan="3" align="center" class="judul"><input type="submit" class="btn" name="simpan" value="Simpan" onclick="return confirm('Apakah anda yakin data relasi ini akan disimpan?')"/> <input type="reset" class="btn" value="Normalkan" /></td>
</tr>
</table>
</form>
</div>
<?php
}
elseif($act=="simpanrelasi"){
$MB = $_POST['MB'];
$MD = $_POST['MD'];
$CF = $_POST['CF'];
$KD_PENYAKIT = $_POST['KD_PENYAKIT'];
$cekgejala = $_POST['cekgejala'];
$jum = count($cekgejala);
if($jum==0){
echo "<meta http-equiv=\"refresh\" content=\"0; url=index_pakar.php?page=9&act=berhasil\">";
}
else{
$qpil = "SELECT * FROM Relasi WHERE KD_PENYAKIT='$KD_PENYAKIT'";
$parsesql = oci_parse($conn, $qpil);
oci_execute($parsesql) or die(oci_error());
while ($datapil=oci_fetch_array($parsesql)) {
for($i = 0; $i < $jum; ++$i){
if($datapil['KD_GEJALA'] != $cekgejala[$i]){
}
}
}
for($i = 0; $i < $jum; ++$i){
$qryr = "SELECT * FROM Relasi WHERE KD_PENYAKIT='$KD_PENYAKIT' AND KD_GEJALA='$cekgejala[$i]'";
$parsesql = oci_parse($conn, $qryr);
oci_execute($parsesql) or die(oci_error());
$cocok= oci_num_rows($parsesql);
if(!$cocok==1){
$qryr="INSERT INTO RELASI(NO_RELASI,KD_PENYAKIT,KD_GEJALA,MB,MD,CF) VALUES('','$KD_PENYAKIT','$cekgejala[$i]','$MB','$MD','$CF')";
$parsesql = oci_parse($conn, $qryr);
oci_execute($parsesql) or die(oci_error());
$gejala = $cekgejala[$i].",";
echo "<meta http-equiv=\"refresh\" content=\"0; url=index_pakar.php?page=9&act=tampil&KD_PENYAKIT=\">";
}
}
echo "<meta http-equiv=\"refresh\" content=\"0; url=?page=9&act=tampil&KD_PENYAKIT=\">";
}
}
?>