php - insert data to mysql using populate dropdown list -
i'm trying insert data database table name dokter , populate dropdown list poliklinik. when i'm trying insert it,the notification keep showing "undifined vaiable : kodep"
here form code
<select class="form1" name="kodecrot"> <?php $query = mysql_query("select * poliklinik"); if(mysql_num_rows($query) != 0) { while($tampil = mysql_fetch_array($query)){ echo "<option value=".$tampil['namapoli'].">".$tampil['namapoli']."</option>"; } } ?> </select>
here 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 * poliklinik namapoli = '$kodepoli'"); while($data = mysql_fetch_array($med)){ $name = $data['namapoli']; $kodep = $data['kodepoli']; } $jad = mysql_query("select * jadwalpraktek hari = '$kodejadwal'"); while($data1 = mysql_fetch_array($jad)){ $jadwal = $data1['hari']; $jaks = $data1['kodejadwal']; } mysql_query("insert dokter(kodedokter, nmdokter, almdokter, telp, kodepoli, kodejadwal)values('$kodedokter','$nmdokter','$almdokter','$telp','$kodep','$jaks')"); ?>
Comments
Post a Comment