Welcome Guest, Not a member yet? Register   Sign In
edit item using pagination
#1

[eluser]gibbo1715[/eluser]
All

I have got a list of my entries in my database restricted via pagination

I have a link to edit items as follows

Code:
foreach($query as $row){
  echo "<tr>";
    echo "<td width=4%> Policy:". $row->id ."</td>";
    echo "<td width=50%>". $row->title ."</td>";
    echo "<td width=20%>". $row->author ."</td>";
    echo "<td width=5%>". $row->year ."</td>";
    echo "<td ALIGN=center width=2% >". anchor('books/input/'.$row->id,'update',array('class'=>'update')) ."</td>";
    echo "<td ALIGN=center width=2% >". anchor('books/del/'.$row->id,'delete',array('class'=>'delete','onclick'=>"return confirm('Are you sure want to delete this person?')")) ."</td>";    
    echo "</tr>";    
}

This is what i use to goto the item i want to edit and I have been using

Code:
redirect('/books/main/', 'refresh');

to get back to my list

Now as far as i can tell pagination uses $this->uri->segment(3) to identify what page of the list to display but i have now gone to my edit page and there for the segment 3 represents the id number of the record i want to update

How would i go about getting it to return to the correct page in my list after an edit?

thanks

Gibbo
#2

[eluser]gibbo1715[/eluser]
I tried using sessions which works for me as follows but keen to know if this is the correct way

thanks

gibbo

$this->session->set_userdata('page', $this->uri->segment(3));

redirect('/books/main/' .$this->session->userdata('page'), 'refresh');




Theme © iAndrew 2016 - Forum software by © MyBB