PDA

View Full Version : Display data beside select option after option selected



newphpbees
05 Jun 2012, 09:14 PM
Hi..

I have a select option where the data came from database and I use php codes for displaying the data to select option. And it works, now I need to display bin_loc base on what lot_number that I choose.


I want to happen is after I choose lot number the bin_loc for that lot_number will also displayed.
here is my code in displaying lot_number:



$query = "SELECT lot_number from wms WHERE (date_shelve IS NOT NULL) AND stock_item = '$ItemCode' AND (qty = orig_qty OR qty != '0.00') AND qty >= '$SubQty' ORDER BY qty";
$rows = mysql_query($query, $con);
echo "<td><select name = 'lot_number' id='lot_number'>";
echo "<option></option>";
while ($record = mysql_fetch_array($rows))
{
echo "<option value = '{$record['lot_number']}'";
if ($lot_number == $record['lot_number'])
echo "selected = 'selected'";
echo ">{$record['lot_number']}</option>";
}
echo "</select>";
echo "</td>";


now I need to display bin_loc in <td></td> after the lot_number;

I tried this:


$sql = "SELECT bin_loc FROM wms WHERE lot_number = '$lot_number'";


but it did not work cause I can get the value of option that I selected.

I hope someone can Help in automatically displaying bin_loc.

Thank you so much