I am trying to have a drop down box that is populated through mySQL and PhP, populate two read only boxes, with PartName and Cost. The drop down box get's populated with the correct choices, and then when I choose a choice from that. My Parts table has these 3 columns: PartID, PartName, Cost. it doesn't populate the read only boxes Here's what the code looks like:
if (!empty($_POST)) {
$partid = $_GET["PartID"];
$sql = "SELECT * FROM Parts WHERE PartID = '$partid'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
$part_name = $row ["PartName"];
$part_cost = $row ["Cost"];
}
$sql = "SELECT PartID FROM Parts WHERE PartID LIKE 'C0%'";
$result = mysql_query($sql);
echo "<select name='PartID' onchange='document.getElementById(\'form1\').submit();'>";
while ($row = mysql_fetch_array($result))
{
echo "<option value='" . $row['PartID'] . "'>" . $row['PartID'] . "</option>";
}
echo "</select>";
echo "<input type='text' value='".$part_name."' />";
echo "<input type='text' value='".$part_cost."' />";