i got this code
<?php
include("konek.php");
mysql_connect('localhost', 'root', '');
mysql_select_db('psc_db');
$sql = "SELECT * FROM komponen ORDER BY komponen_id";
//$query = "SELECT * FROM taxi_services ORDER BY SID";
$result2 = mysql_query($sql); //$conn
if(isset($_POST["loadbtn"]))
{
$id = (integer) $_POST["codes"];
$query = "SELECT nama_komponen, ekuivalen_sks, ekuivalen_jam FROM komponen WHERE komponen_id = '$id' ";
$result = mysql_query($sql);
$details = mysql_fetch_array($result);
$savedName = $details["nama_komponen"];
$savedJam = $details["ekuivalen_sks"];
$savedSks = $details["ekuivalen_jam"];
}
?>
<html>
<head>
</head>
<body>
<div id="upserv">
<b id="caption2">Planning</b>
<br/><br/>
<form name="upServForm" method="post" >
<?php
$dropdown = "<select name='codes'>";
while($row = mysql_fetch_assoc($result2))
{
$dropdown .= "
<option value='{$row['komponen_id']}'>{$row['komponen_id']}</option>";
}
$dropdown .= "
</select>";
?>
Service ID <?php echo $dropdown; ?> <input type="submit" value="Load" name="loadbtn">
<table width="300" border="0">
<tr>
<td>Name</td>
<td><input type="text" name="upName" style="text-align:right" value="<? echo $savedName; ?>" /></td>
</tr>
<tr>
<td>ekuivalen sks</td>
<td><input type="text" name="upCost" style="text-align:right" value="<? echo $savedJam; ?>" /></td>
</tr>
<tr>
<td>ekuivalen jam</td>
<td><input type="text" name="upActive" style="text-align:right" value="<? echo $savedSks; ?>" /></td>
</tr>
</table>
</div>
<br/>
<div id="buttons">
<input type="reset" value="Clear" /> <input type="submit" value="Save" name="updatebtn" />
</div>
</form>
</body>
</html>
and the result is something like this
I still haven't sucessfully display the data when I click the button. I got the example code from another post, and I tried it and above is the result(but I'm still fail). All I want to do is to display the data into the textbox without the load button
Can you help me coding this code please, thank you
</div>