This topic is locked
[SOLVED]

 Redirect to next record after save

1/28/2014 6:34:18 AM
PHPRunner General questions
romaldus author

in phprunner 7 (edit page):

how to redirect to next record after successfully save current record?

Sergey Kornilov admin 1/28/2014

Yes, this is possible.
You need to calculate the ID of the next record in AfterEdit event and redirect user there. This task is trivial when data is always ordered by ID. If user changes data sort order getting to the next record in the List will be tricky.
Here is an idea. Make sure you change table and field names.
AfterEdit:

$nextid=DBLookup("select id from TableName where id>".$_REQUEST["editid1"]." order by id");

header("Location: tablename_edit.php?editid1=".$nextid);
romaldus author 1/28/2014

perfect. problem solved.



Yes, this is possible.
You need to calculate the ID of the next record in AfterEdit event and redirect user there. This task is trivial when data is always ordered by ID. If user changes data sort order getting to the next record in the List will be tricky.
Here is an idea. Make sure you change table and field names.
AfterEdit:

$nextid=DBLookup("select id from TableName where id>".$_REQUEST["editid1"]." order by id");

header("Location: tablename_edit.php?editid1=".$nextid);