gan saya mau tanya Cara tampilin isi textboxt dinamis sesuai dengan combobox yg dipilh codingnya sperti dibawah ini gan, ketika saya pilih nama unit, kalau datanya udh di simpan di database secara otomatis texboxtnya diisi jika belum data masih kosong dan di insertkan dulu, ini scriptnya gan
<?php
include('cek-login.php');
?>
<?php
$host = 'localhost';
$user = 'root';
$pass = '';
$dbname = 'direktori';
$connect = mysql_connect($host, $user, $pass) or die(mysql_error());
$dbselect = mysql_select_db($dbname);
?>
<html>
<head>
<title> Pengisian Data </title>
<script src=â€jquery.jsâ€></script>
<script src=â€bawaan/ui/jquery.ui.core.jsâ€></script>
<script src=â€bawaan/ui/jquery.ui.widget.jsâ€></script>
<script src=â€bawaan/ui/jquery.ui.datepicker.jsâ€></script>
<link rel=â€stylesheet†href=â€bawaan/themes/base/jquery.ui.all.cssâ€>
<link rel=â€stylesheet†href=â€jquery/bawaan/demos/demos.cssâ€>
<link rel="stylesheet" href="admin.css" type="text/css" />
</head>
<body>
<div id="header">
<div class="logo"> Admin Data Direktori </div>
</div>
<div id="menu">
<ul>
<li><a href="http://localhost/Direktori_its"> Direktori</a>
<ul>
<li><a href="logout.php">Logout</a></li>
</ul>
</li>
<li><a href="#">User</a>
<ul>
<li><a href="http://localhost/Direktori_its/admin/index_admin.php">New User</a></li>
<li><a href="http://localhost/Direktori_its/admin/view.php">View Data User</a></li>
</ul>
</li>
<li><a href="#">Data</a>
<ul>
<li><a href="http://localhost/Direktori_its/admin/data.php">New Data</a>
<li><a href="http://localhost/Direktori_its/admin/view_data.php">View Data Direktori</a></li>
</ul>
</li>
<li><a href="#"> Unit </a>
<ul>
<li><a href="http://localhost/Direktori_its/admin/satker.php">New Unit</a>
<li><a href="http://localhost/Direktori_its/admin/view_data_unit.php">View Data Unit</a></li>
</ul>
</li>
</ul>
</div>
<?php
if (!empty($_GET) && $_GET == 'success') {
echo '<h3>Berhasil menambah data!</h3>';
}
?>
<div id="wraper">
<table border="0" cellpadding="3" cellspacing="0" align="center" class="data_input" >
<tbody>
<form action="proses.php" method="post" enctype="multipart/form-data">
<tr>
<td><div align="left">Nama Unit</div></td>
<td width="0"><div align="center">:</div></td>
<td><label for="textfield" ></label>
<?php echo "<select name='nama_unit'>
<option value=0 selected>- Pilih satker -</option>";
$tampil=mysql_query("SELECT * FROM satker ORDER BY nama");
while ($qtabel = mysql_fetch_assoc($tampil))
{
echo '<option value="'.$qtabel.'">'.$qtabel.'</option>';
}
echo "</select>"; ?>
</td>
</tr>
<tr>
<td width="200">Kepala Unit/Ketua</td>
<td><div align="center">:</div></td>
<td><input type="text" name="kepala_badan" id="kepala_badan" required="required" value="<?php echo $data; ?>"/></td>
</tr>
<tr>
<td><div align="left">Alamat</div></td>
<td><div align="center">:</div></td>
<td><input type="text" name="alamat" id="alamat" required="required" value="<?php echo $data; ?>"/></td>
</tr>
<tr>
<td><div align="left">Kota</div></td>
<td><div align="center">:</div></td>
<td><input type="text" name="kota" id="kota" required="required" value="<?php echo $data; ?>"/></td>
</tr>
<tr>
<td><div align="left">Kode Pos</div></td>
<td><div align="center">:</div></td>
<td><input type="text" name="kode_pos" id="kode_pos" required="required" value="<?php echo $data; ?>"/></td>
</tr>
<tr>
<td><div align="left">Telepon</div></td>
<td><div align="center">:</div></td>
<td><input type="text" name="telepon" id="telepon" required="required" value="<?php echo $data; ?>"/></td>
</tr>
<tr>
<td><div align="left">Fax</div></td>
<td><div align="center">:</div></td>
<td><input type="text" name="fax" id="fax" required="required" value="<?php echo $data; ?>"/></td>
</tr>
<tr>
<td><div align="left">PABX</div></td>
<td><div align="center">:</div></td>
<td><input type="text" name="pabx" id="pabx" required="required" value="<?php echo $data; ?>"/></td>
</tr>
<tr>
<td><div align="left">Email</div></td>
<td><div align="center">:</div></td>
<td><input type="text" name="email" id="email" required="required" value="<?php echo $data; ?>"/></td>
</tr>
<tr>
<td><div align="left">Website</div></td>
<td><div align="center">:</div></td>
<td><input type="text" name="website" id="website" required="required" value="<?php echo $data; ?>"/></td>
</tr>
<tr>
<td><div align="left">Upload Peta</div></td>
<td><div align="center">:</div></td>
<td><input type="file" name="foto" id="foto" value="<?php echo $data; ?>"></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="submit" value="Simpan" /></td>
</tr>
</tbody>
</table>
</div>
<div id="footer"> </div>
</body>
</html>
Mohon bantunya ya gan ?? Terimakasih banyak
Silahkan
login untuk menjawab!