问题描述:

i'm trying to insert data to my database table name dokter and the populate dropdown list from poliklinik. but when i'm trying to insert it,the notification keep showing "undifined vaiable : kodep"

here the form code

<select class="form1" name="Kodecrot">

<?php

$query = mysql_query("select * from poliklinik");

if(mysql_num_rows($query) != 0) {

while($tampil = mysql_fetch_array($query)){

echo "<option value=".$tampil['Namapoli'].">".$tampil['Namapoli']."</option>";

}

}

?>

</select>

here the process code

<?php

include'../koneksi.php';

$KodeDokter = $_POST['KodeDokter'];

$NmDokter = $_POST['NmDokter'];

$AlmDokter = $_POST['AlmDokter'];

$Telp = $_POST['Telp'];

$KodePoli = $_POST['Kodecrot'];

$KodeJadwal = $_POST['KodeJadwal'];

$med = mysql_query("select * from poliklinik where Namapoli = '$KodePoli'");

while($data = mysql_fetch_array($med)){

$name = $data['Namapoli'];

$kodep = $data['Kodepoli'];

}

$jad = mysql_query("select * from jadwalpraktek where Hari = '$KodeJadwal'");

while($data1 = mysql_fetch_array($jad)){

$jadwal = $data1['Hari'];

$jaks = $data1['KodeJadwal'];

}

mysql_query("insert into dokter(KodeDokter, NmDokter, AlmDokter, Telp, Kodepoli, KodeJadwal)values('$KodeDokter','$NmDokter','$AlmDokter','$Telp','$kodep','$jaks')");

?>

相关阅读:
Top