[eluser]Bianca Migueis[/eluser]
but everything else works perfectly fine with $data[username]... I checked the view source and only thing that is not set as it should is the value...
EDIT: I figured it out. nothing like a good night of sleep to give you some perspective... Apparently the set_value function needs to be run after the $this->form_validation->run() so I just transfered my array to inside the if clause. now it works perfectly with this code:
Code:
public function index()
{
$data['loggedin'] = $this->cookie->checkcookie();
if ($this->form_validation->run('register') == FALSE)
{
$data['username'] = array(
'name' => 'username',
'id' => 'username',
'value' => set_value('username'),
'maxlength' => '24',
'size' => '24',
'style' => '',
);
$data['password'] = array(
'name' => 'password',
'id' => 'password',
'value' => set_value('password'),
'maxlength' => '24',
'size' => '24',
'style' => '',
);
$data['password2'] = array(
'name' => 'password2',
'id' => 'password2',
'value' => set_value('password2'),
'maxlength' => '24',
'size' => '24',
'style' => '',
);
$data['first'] = array(
'name' => 'first',
'id' => 'first',
'value' => set_value('first'),
'maxlength' => '24',
'size' => '24',
'style' => '',
);
$data['middle'] = array(
'name' => 'middle',
'id' => 'middle',
'value' => set_value('middle'),
'maxlength' => '24',
'size' => '24',
'style' => '',
);
$data['last'] = array(
'name' => 'last',
'id' => 'last',
'value' => set_value('last'),
'maxlength' => '24',
'size' => '24',
'style' => '',
);
$data['email'] = array(
'name' => 'email',
'id' => 'email',
'value' => set_value('email'),
'maxlength' => '128',
'size' => '50',
'style' => '',
);
$data['submit'] = array(
'name' => 'register',
'id' => 'register',
'value' => 'Register',
'maxlength' => '24',
'size' => '24',
'style' => '',
);
$this->load->view('register_view', $data);
}
else
{
$this->updateDB($_POST);
}
}