Welcome Guest, Not a member yet? Register   Sign In
No fields after validation reload
#1

[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>

&lt;?php
foreach($query->result() as $row):
?&gt;


&lt;input type="hidden" name="customer_type_id" value="&lt;?php echo set_value('customer_type_id','$row-&gt;customer_type_id'); ?&gt;" />


<tr>
  <th>Customer Type</th>
      <td>
             <label>Customer Type &lt;input type="text" name="customer_type" value="&lt;?php echo set_value('customer_type',"$row-&gt;customer_type"); ?&gt;" /> </label>    
      </td>
</tr>

<tr>
   <th>Record Status</th>
      <td>  
  <label>Record Status
     <select name="select"   value="&lt;?php echo set_value('record_status',"$row->record_status"); ?&gt;" >
       <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">
        &lt;input name="Send" type="submit" value="Submit"&gt;
        </div>
      </td>
</tr>

&lt;/form&gt;


&lt;?php  
endforeach;
else:
?&gt;

&lt;?php echo 'There is no record matching the search criteria' ?&gt;

&lt;?php  
endif;
?&gt;

&lt;?php  
}
?&gt;
#2

[eluser]elmne[/eluser]
resolved by replicating same code without query




Theme © iAndrew 2016 - Forum software by © MyBB