I'm trying to show the price in the drop down list from the following code, however it is showing the product name and not the price:
<?php
//-----------------------PROCESSOR---------------------------
$query="SELECT product_name, price FROM processor";
$result = mysql_query($query);
$options="";
echo "<select name='processor' value=''>
<option>Please Select A Processor</option>";
while($nt=mysql_fetch_array($result))
{
echo "<option value='".$nt['price']."'>".$nt['product_name']."</option>";
}
echo "</select>";
?>
Can anyone help with what I am doing wrong?
thanks in advance!
Just replace
echo "<option value='".$nt['price']."'>".$nt['product_name']."</option>";
with
echo "<option value='".$nt['price']."'>".$nt['price']."</option>";
Have a look at the documentation: http://www.w3schools.com/tags/tag_option.asp