I'm doing some project about the material science. I stuck on the php coding. My project plan is make a drop down list from the database whicih is connected and worked fine and when I select one metal from the drop down list, it shows the structure type of metal. This part is not working at all and give me some http 500 error when I wrote the code. I think it is something wrong with my code.
select class="form-control" name="metalname" id="metalname">
<?php
$sql = mysql_query("SELECT name FROM metal");
while($row=mysql_fetch_array($sql)){
echo"<option value=\"name\">" . $row['name']."</option>";
}
?>
</select>
</div>
<div class="form-group">
<div class="input-group">
<div class="input-group-addon" id="basic-addon1">Type</div>
<?php
$valStructure = $_POST['metalname'];
$structure = mysql_fetch_array("SELECT structure_type FROM metal WHERE name='$valStructure");
while($row1=mysql_fetch_array($structure)){
echo" <input type="text" class="form-control" id="pricefrom" aria-describedby="basic-addon1" value=\"structure_type\">".$row1['structure_type'];
}
?>
So drop down list part is works fine. But when I try to get the metal name from the select class, it gives me some error. Please help me !!