Welcome Guest, Not a member yet? Register   Sign In
HI guys how can i use same form for edit and add data into database?
#9

[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>
&lt;input type="text" id="firstname" name="firstname" value="&lt;?=$row-&gt;firstname?&gt;"><br>
<label for="surname">Surname: </label>
&lt;input type="text" id="surname" name="surname" value="&lt;?=$row-&gt;surname?&gt;"><br>
<label for="initial">Initials: </label>
&lt;input type="text" id="initial" name="initial" value="&lt;?=$row-&gt;initials?&gt;"><br>

help would be appreciated;


Messages In This Thread
HI guys how can i use same form for edit and add data into database? - by El Forum - 04-08-2009, 02:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB