[eluser]elmne[/eluser]
I have a view with a form for update which is populated from the database. When it's submitted, the controller runs validation checks then reloads view if a required field is not filled in.
All is working well but upon reload, the form fields don't show up, only the validation message, what's the cause for this?
Code:
<?php
if(isset($query))
{
if($query->num_rows() > 0):
?>
<strong> Edit form</strong>
<br />
<br />
<table>
<?php
foreach($query->result() as $row):
?>
<input type="hidden" name="customer_type_id" value="<?php echo set_value('customer_type_id','$row->customer_type_id'); ?>" />
<tr>
<th>Customer Type</th>
<td>
<label>Customer Type <input type="text" name="customer_type" value="<?php echo set_value('customer_type',"$row->customer_type"); ?>" /> </label>
</td>
</tr>
<tr>
<th>Record Status</th>
<td>
<label>Record Status
<select name="select" value="<?php echo set_value('record_status',"$row->record_status"); ?>" >
<option value="">----------------------</option>
<option value="active">Active</option>
<option value="inactive">Inactive</option>
</select>
</label>
</td>
</tr>
<tr>
<td>
</td>
<td>
<br /><br /><br />
<div align="right">
<input name="Send" type="submit" value="Submit">
</div>
</td>
</tr>
</form>
<?php
endforeach;
else:
?>
<?php echo 'There is no record matching the search criteria' ?>
<?php
endif;
?>
<?php
}
?>