[eluser]Waqar[/eluser]
I am having problem loading the view form with values. it will load the edit form
but when i click on add it will give me severity error and undefined row
Quote:<?php
if($this->uri->segment(3)){
$id=$this->uri->segment(3);
$this->load->database();
$query= $this->db->query("SELECT * FROM `individuals` WHERE id='$id'");
foreach($query->result() as $row){
}
}
?>
<input type="hidden" name="id" value="<?=$row->id?>" />
<label for="firstname">First Name: </label>
<input type="text" id="firstname" name="firstname" value="<?=$row->firstname?>"><br>
<label for="surname">Surname: </label>
<input type="text" id="surname" name="surname" value="<?=$row->surname?>"><br>
<label for="initial">Initials: </label>
<input type="text" id="initial" name="initial" value="<?=$row->initials?>"><br>
help would be appreciated;