Welcome Guest, Not a member yet? Register   Sign In
HELP!
#1

[eluser]Sub-Zero[/eluser]
Hello!

This is my first time using CI. I have created a form (saved it in the views folder) to update a record. I was able to go from the controller function to the form (in views) and display all the values from my db without any problems at all. Right now, I'm changing the values of the variables in my form and this is where I'm having problems passing the new values of my variables to the controller. The problem is that I'm getting an undefine variable error when I try to display the context of the variable inside the function. Right now, I'm doing a test in passing one field (first name) from my form to my controller function update(). I put some sample code of my form and the controller. Comments are welcome! Thank you!

Here is sample code of the form (views folder):
<html>
.
.
.
$hidden = array('FirstName'=>$row[0][0]);
echo form_open('personal/update/','',$hidden);
.
.
.
<?php echo form_submit('Up_button', 'Update Record');?>
<input type="reset" value=:Reset"/>
<?php echo form_close();?>
</html>

Here is sample code of the function (controller folder):

function update()
{
echo "Testing";
.
.
.
$this->db_personal->updatepersonal();
}
#2

[eluser]Johan André[/eluser]
The values are retrieved in the controller by using: $this->input->post('name_of_form_field')

Actually, at first I thought your form_open() was weird, but after reading the userguide I saw that you CAN add hidden fields to a form that way! Very cool!

Hope this works for you!
#3

[eluser]Sub-Zero[/eluser]
Johan, thanks for the info!!!




Theme © iAndrew 2016 - Forum software by © MyBB