[eluser]geocine[/eluser]
i have this code snippet on my
page controller
Code:
function edit( $id = '')
{
$this->load->library('session');
$this->load->library('form_validation');
switch ( $_SERVER ['REQUEST_METHOD'] )
{
case 'GET':
$this->session->set_flashdata( 'id', $id );
break;
case 'POST':
$this->form_validation->set_rules( 'page_Category', lang('page_Category'), 'required' );
if ( $this->form_validation->run() == FALSE )
{
$this->session->keep_flashdata('id');
$data['values']['page_Category'] = set_value( 'page_Category' );
$data['form_mode'] = 'edit';
$this->load->view( 'edit_ezloadinc_page.php', $data );
}
elseif ( $this->form_validation->run() == TRUE )
{
$data_post['page_Category'] = $this->input->post( 'page_Category' );
$id = $this->session->flashdata('id');
redirect( 'page/info/' . $id );
}
break;
default:
break;
}
}
if I would be editing an entry using
page/edit/1,
1 should be stored on flashdata since its a
GET request. Once the user submits the form after editing it will be going to
page/edit and through the
POST request it will then be redirected to
page/info/<the id that was stored on the flashdata>.
The weird thing that happens is when
$id = $this->session->flashdata('id'); is called. The returned value to id is "
css"
I tried using
userdata but the same thing happens. What seems to be the problem?