Koneksi Database.php:
Edit:
_________________________________________________________________________________
Output:
Output:
Edit:
_________________________________________________________________________________
<?php include
"koneksi.php";?>
<table
border="1" width="550" align="center">
<tr><td
height=20 align="center" width=50><b>Kode</b></td>
<td
align="center" width=170><b>Nama
Penyakit</b></td>
<td
align='center' width=250><b>Definisi</b></td>
<td
align='center' width=80><b>Fungsi</b></td>
</tr>
<?php
$kirim_edit =
(!empty($_GET['kode']) ? $_GET['kode'] : '');
$edit =
(!empty($_GET['edit']) ? $_GET['edit'] : '');
if($kirim_edit==1)
{
$query3 =
"update penyakit set kode='$kode_penyakit',
nama='$nama_penyakit',
definisi='$definisi'
where
kode='$kodeg'";
mysql_query($query3);
}
$i=0;
$qdata =
mysql_query("select kode,nama,definisi from penyakit order by kode");
while($rdata =
mysql_fetch_array($qdata))
{
$pkode =
$rdata["kode"];
$pnama =
$rdata["nama"];
$pdefinisi =
$rdata["definisi"];
echo
"<tr><td align='center'>$pkode</td><td
>$pnama</td>
<td>$pdefinisi</td><td
align='center'>
<a href='edit_data.php?kode=$pkode&edit=1'>Edit</a></td></tr>";
$i++;
}?>
</table>
<br>
<?php
if($edit==1)
{
$kode = $kirim_edit;
$qdata2 =
mysql_query("select nama, definisi from penyakit where
kode='$kode'");
while($rdata2 =
mysql_fetch_array($qdata2))
{
$nama2 =
$rdata2["nama"];
$definisi2 =
$rdata2["definisi"];
}
echo "<p
align='center'>Ubah Data Penyakit <br><br>";
echo "<form
method='post' action='edit_data.php'>
<input
type='hidden' name='kodeg' value='$kode'>
<input
type='hidden' name='kirim_edit' value=1>";
echo "<table
border=0 width=500 align='center'>";
echo
"<tr><td width=150>Kode Penyakit
</td><td><input type='text' name='kode_penyakit' size=4
value='$kode'></td></tr>
<tr><td>Nama
Penyakit </td>
<td><input
type='text' name='nama_penyakit' size=40 value='$nama2'></td></tr>
<tr><td
valign='middle'>Definisi Penyakit </td>
<td><textarea
name='definisi' cols=40
rows=6>$definisi2</textarea></td></tr>
<tr><td
colspan=2 align='center'><input type='submit'
value='EDIT'></td></tr>";
echo
"</table></form></p>";
}
?>
_________________________________________________________________________________Output:
Semoega bermanfaat....Terima Kasih !!
Tidak ada komentar:
Posting Komentar