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

[eluser]Waqar[/eluser]
Sorry for troubling you, i did it exactly like that the method you posted now. but when i use the same form for adding data it will give me udefined row severity error.
my add function is like
Quote:function add_form()
{

$this->load->view('individual/individual_form');
}

the edit works fine only when i load the form for adding purpose it gives me error.

I am newbie i hope you not getting angry coz i am asking lot
#12

[eluser]Waqar[/eluser]
I know i am not definig the row in my above controller. can you please tell me a method that i could define the row in this one as empty value so my form must not give error
#13

[eluser]Waqar[/eluser]
can i use something like this?
Code:
<label for=“surname”>Surname: </label>
      &lt;input type=“text” id=“surname” name=“surname” value=”&lt;?php if($data){echo $row-&gt;surname}?&gt;”>
#14

[eluser]umefarooq[/eluser]
hi you are doing wrong pass data with loading view like this

$data['row'] = $this->model_name->get_record();
$this->load->view(‘individual/individual_form’,$data);

check like this
&lt;?php if($row->surname){echo $row->surname}?&gt;
#15

[eluser]Waqar[/eluser]
The editing part works fine. I am having problem with adding new data. how i can use the same form to add data. when i try that it give me severity error undefined row.
because i am not passing any value from controler trying to load the form empty
#16

[eluser]umefarooq[/eluser]
for that i already post above that use form helper check my post number 3 or 7 this is how we can use form helper.

&lt;?=form_input($title)?&gt;
&lt;?=form_hidden($id)?&gt;




Theme © iAndrew 2016 - Forum software by © MyBB