I've written this piece of code:
<select name="account_type" id="account" class="form-control" required>
<option value="Asset">Asset</option>
<option value="Bank">Bank</option>
<option value="Capital">Capital</option>
<option value="Cash" <?php if($_POST['Cash'] == $ledger_account){?> selected <?php }?>>Cash</option>
<option value="Expense">Expense</option>
<option value="Income">Income</option>
<option value="Liability">Liability</option>
<option value="Creditors">S. Creditors</option>
</select>
I got a value from different page, which is stored in $ledger_account. However, I want to see an option (for example, Cash) to be selected here when the page loaded if the option value matches with $ledger_account value. Please help me to identify what I've done wrong here.