This topic is locked

Redirect user after adding a new record

11/24/2014 12:49:03 PM
PHPRunner Tips and Tricks
admin

Sometimes you need to redirect user to another page after new record was added. We'll show how this can be done for different types of pages (List/Edit/View/Print)
You will have to add this code to AfterAdd event. In these examples we assume that table name is Cars and key column name is ID. Make sure to replace it with the actual table and field names (case-sensitive).
Redirect back to the List page

header("Location: Cars_list.php?a=return");

exit();


Redirect to the Edit page of the record just added

header("Location: Cars_edit.php?editid1=".$keys["ID"]);

exit();


Redirect to the View page of the record just added

header("Location: Cars_view.php?editid1=".$keys["ID"]);

exit();


Redirect to the Print page of the record just added

header("Location: Cars_print.php?a=print&selection[]=".$keys["ID"]);

exit();
B
bioman 10/30/2016

This is exactly what I was looking for! Thanks,

Brett



Sometimes you need to redirect user to another page after new record was added. We'll show how this can be done for different types of pages (List/Edit/View/Print)
You will have to add this code to AfterAdd event. In these examples we assume that table name is Cars and key column name is ID. Make sure to replace it with the actual table and field names (case-sensitive).
Redirect back to the List page

header("Location: Cars_list.php?a=return");

exit();


Redirect to the Edit page of the record just added

header("Location: Cars_edit.php?editid1=".$keys["ID"]);

exit();


Redirect to the View page of the record just added

header("Location: Cars_view.php?editid1=".$keys["ID"]);

exit();


Redirect to the Print page of the record just added

header("Location: Cars_print.php?a=print&selection[]=".$keys["ID"]);

exit();


admin 10/31/2016

In later versions of PHPRunner this functionality is built-in.

B
bioman 11/1/2016

Hi Sergey,

How is it built in? Thanks, Brett