Select the option from a Combo box
Posted: Mon Dec 28, 2009 4:17 am
This is for editing a record. When the user click the edit button, the id of the record will pass to editin.php page and all the value will retrieve from db and must fill in the form controls. The problem is the values sit properly in text boxes but not in combo boxes. The code i am using is
<?php
while($row = mysql_fetch_array($result))
{
array_push($dd,$row['product_code']);
$temp_pid = $row['product_code'];
echo '<option value='.$row['product_code'].' if($temp_pid == $product_code1) {echo "selected=selected"; } >'.$row['product_code'].'</option>';
}
echo '</select>';
?>
But it doesnt suit me,. Please help me doing this.
<?php
while($row = mysql_fetch_array($result))
{
array_push($dd,$row['product_code']);
$temp_pid = $row['product_code'];
echo '<option value='.$row['product_code'].' if($temp_pid == $product_code1) {echo "selected=selected"; } >'.$row['product_code'].'</option>';
}
echo '</select>';
?>
But it doesnt suit me,. Please help me doing this.