Hi... Need your help with my case below :
- Index.php
<table>
<tr>
<td>Badge ID</td>
<td>Employee Name</td>
<td>Department</td>
<td>Overtime Date</td>
<td>From</td>
<td>To</td>
<td>Remarks</td>
</tr>
<?php
$n = $_POST['jum'];
for ($i=1; $i<=$n; $i++)
{
echo '
<tr>
<td><input type="text" size="7" name="badgeid' . $i .'" maxlength="6"
onchange="javascript:this.value=this.value.toUpperCase();"
onkeyup="getCity(\'search.php?badgeid=\'+this.value, \'name' . $i . '\',\'dept' . $i . '\');"></td>
<td><input type="text" size="15" name="name' . $i . '" id="name' . $i . '" readonly></td>
<td><input type="text" size="12" name="dept' . $i . '" id="dept' . $i . '"></td>
<!-- -->
<td><input type="text" size="12" name="otdate' . $i .'" id="date" class="date-pick"
onChange="javascript:this.value=this.value.toUpperCase();" readonly></td>
<td><input type="text" size="4" name="otfrom' . $i . '" id="time1" value=\'\' readonly ></td>
<td><input type="text" size="4" name="otto' . $i . '" id="time2" value=\'\' readonly ></td>
<td><input type="text" size="25" name="remarks' . $i . '" ></td>
</tr>';
}
?>
</table>
2.
<?php
include_once('config.php');
if (isset($_GET['badgeid']))
{
$qry = "SELECT name,dept FROM employee WHERE badgeid = '" . $_GET['badgeid'] . "' ";
$sql = mysql_query($qry);
$ary = mysql_fetch_array($sql);
echo $ary['name'];
echo $ary['dept'];
}
?>
I want to set the value name and department to each textbox, that's textbox_name and textbox_dept.
The one value was correct, when I input the badge ID then the value name show in textbox_name. But textbox_dept not change.
The value of dept also filled in textbox_name.
Appreciate with your helps. 😃
Thanks.