Question:
I'm trying to make a form to add error log entries into a database.
Some error codes are already known in the DB, others are not.
What I want to do, is the following: when people fill in an existing error code in the designated field, I want to display the description of that error code in another field from the moment they leave the error code field (onChange).
I think this should involve both PHP and JS, but I can't figure out how...
Also, to make things easy, I want users to be able to enter 10 new records at a time, so I need to work with an array indicator, or something.
Here's parts of the page as it is now:
Code: Select all
<form action="cl-el-de-post.php" method="post" name="cl-el-de">
<table class="ContentTable" cellspacing="0">
<tr>
<td class="ContentText">Date<br />Collected</td>
<td class="ContentText">Technician</td>
<td class="ContentText">Error Code</td>
<td class="ContentText">Date</td>
<td class="ContentText">Time</td>
<td class="ContentText"># Times</td>
<td class="ContentText">Error Description</td>
</tr>
<?php
mysql_select_db($database_SOLBEL, $SOLBEL);
$query_TECHS = "SELECT * FROM techs ORDER BY t_techid ASC";
$TECHS = mysql_query($query_TECHS, $SOLBEL) or die(mysql_error());
$row_TECHS = mysql_fetch_assoc($TECHS);
$totalRows_TECHS = mysql_num_rows($TECHS);
?>
<tr>
<td class="ContentTextSmall"><input name="ll_date[1]" type="text" size="10" /></td>
<td class="ContentTextSmall"><select name="ll_tech[1]">
<option selected="selected"></option>
<?php do { ?>
<option value="<?php echo $row_TECHS['t_techid']; ?>"><?php echo $row_TECHS['t_techid']; ?></option>
<?php } while ($row_TECHS = mysql_fetch_assoc($TECHS)); ?>
</select></td>
<td class="ContentTextSmall"><input name="ll_code[1]" type="text" size="4" onChange="javascript:this.value=this.value.toUpperCase();" /></td>
<td class="ContentTextSmall"><input name="ll_year[1]" type="text" size="2" value="06" />.<input name="ll_day[1]" type="text" size="3" /></td>
<td class="ContentTextSmall"><input name="ll_time[1]" type="text" size="5" /></td>
<td class="ContentTextSmall"><input name="ll_times[1]" type="text" size="2" /></td>
<td class="ContentTextSmall"><input name="lmc_desc[1]" type="text" size="75" /></td>
</tr>
<?php
mysql_free_result($TECHS);
?>Thanks up front!
PinkFloyd