hi ppl of the forum..
i am so glad i joined this forum, members here play a big role in my learning PHP, n im able to work on a PHP project so soon all thanks to the forum and its members..
n here i'm back again, with another piece of my code, not working the way it is supposed to. its issue with my logic i guess.
whats happening here is, i am fetching data from db and displaying it in the form. form has dropdown and textfield. basically this is a edit form, so it should display all the data entered by the user. the data entered in the textfield is appearing properly, but one of the dropdown doesnt display all the options.
<?php
for($i=0; $i<$cnt; $i++)
{
?>
<tr>
<td>
<?php
echo "<select name='component' id='component' ><option>".$itemName[$i]."</option>";//$itemName[$i] displayes the option selected
while($rowComp = mysql_fetch_array($resComp))
{
echo "<option id=".$rowComp['id']." value=\"".$rowComp['name']."\">".$rowComp['name']."</option>";
}
?>
</select>
</td>
<td><input type="text" id="quantity" name="quantity" value="<?php echo $quantity[$i] ?> "></td>
<td><input type="text" id="rate" name="rate" value="<?php echo $rate[$i] ?>"></td>
<td><input type="text" id="total" name="total" value="<?php echo $total[$i] ?>"></td>
</tr>
<?php
}
?>
for the condition $cnt=2 and 2 options within the dropdown, two rows of this edit form appear, out of which 1st row displays all details correctly, however in the 2nd row only one option is displayed in the drop down.
pls have a look at the code and point out where iam going wrong..
thank you ppl