I am using the same view page for both submitting data to database and editing. When I submit the form all the elements go to database. When editing the input field contains the item to edit but the dropdown form doesnot load and displays error saying $expensetype not defined. the $expensetype is passed through the controller to the form. I am developing in pyrocms. Pyrocms is developed in Codeigniter.
<li>
<label for="expense_type_id">Expense Type</label> <!-- expense_type_id-->
<div class="input">
<?php echo form_dropdown("expense_type_id",$expensetype, set_value("expense_type_id", $expense_type_id)); ?>
</div>
</li><li>
<label for="expense_rs">Expense(NRS)</label> <!-- expense_rs-->
<div class="input">
<?php echo form_input("expense_rs", set_value("expense_rs", $expense_rs)); ?>
</div>
</li>
How to make the dropdown to show the item while editing.