Dharmeshdhabu
New member
I have similar problem.
I have one tab source from where I fatch value from column 'Pathology' into option and then insert into another table bdaily column 'Pathology'. Till here it is working fine . But in view I want to fatch same inserted value from bdaily column 'Pathology' and get it selected in dropdown. I tried above code given by you but it donot work. Selected value comes last row which is blank. Please guide me.
Here is my code.
I have one tab source from where I fatch value from column 'Pathology' into option and then insert into another table bdaily column 'Pathology'. Till here it is working fine . But in view I want to fatch same inserted value from bdaily column 'Pathology' and get it selected in dropdown. I tried above code given by you but it donot work. Selected value comes last row which is blank. Please guide me.
Here is my code.
Code:
<td style="padding:10px;">Pathology</td>
<td>
<?php $results = mysqli_query($conn, "SELECT * FROM source where Pathology is not null"); ?>
<select class="form-control" name="Pathology" value="<?php echo trim($Pathology); ?>" id="Pathology">
<?php while ($row = mysqli_fetch_array($results)) { ?>
<option data-id="<?php echo $row['PAmount']; ?>" value="<?php echo $row['Pathology']; ?>"
<?php if($row['Pathology']==$row['Pathology']);
{
echo "selected";
}
?>
><?php echo $row['Pathology']; ?>
</option>
<?php } ?>
</select>
</td>