Question: I have made some code to create a dropdown in a webpage and you can select among 2 currency values namely USD and SGD. I have been able to get the value for the currency field while entering the data in the database. But while trying to edit the entry in the database, I am able to use $\_POST to get all entries to display except the value of currency. I would ideally want to display the previously selected value on the dropdown. As of now the drop down on the edit page just displays the default "Please Choose" and doesn't show the previously selected value. any help would be greatly appreciated.

Code : 

```html
  <select id="currency" name="currency" placehoder="Currency">
      <option value='' disabled selected style='display:none;'>Please Choose</option>
      <option value="SGD">SGD</option>
      <option value="USD">USD</option>
  </select> 
```

And I am trying to somehow display the previously read value that exists in the database and display that instead of the "Please Choose" so that while editing I don't have to re-select the currency value.

Answer: 
Supposing you stored in `$currency` the value from DB:

```
<select id="currency" name="currency" placehoder="Currency">
    <option value='' disabled style='display:none;'>Please Choose</option>
    <option value="SGD"<?php echo $currency == "SGD" ? " selected" : ""; ?>>SGD</option>
    <option value="USD"<?php echo $currency == "USD" ? " selected" : ""; ?>>USD</option>
</select>

```
Use PHP to Solve it..

```
<select name="select_limitby" onChange="frm_sub()">
            <?php if($_SESSION[select_limitby]!='') { ?>
                <option value="<?php echo $_SESSION[select_limitby]; ?>" <?php if($_POST[select_limitby]=='$_SESSION[select_limitby]') {?> selected="selected" <?php }?>><?php echo $_SESSION[select_limitby]; ?></option>
            <?php } ?>
            <option value="">Default</option>
            <option value="9" <?php if($_POST[select_limitby]=='9') {?> selected="selected" <?php }?>>9</option>
            <option value="12" <?php if($_POST[select_limitby]=='12') {?> selected="selected" <?php }?>>12</option>
            <option value="15" <?php if($_POST[select_limitby]=='15') {?> selected="selected" <?php }?> >15</option>
        </select>

```

USE session if it does not work...
otherwise you can leave session...