This topic is locked

Redirect to Add page

12/30/2009 7:23:03 AM
PHPRunner General questions
D
doykoes author

Hi,
Please somebody help,
When user click on detail table link at list page at master table (PHP runner automaticaly created it),

i want to redirect it to Add page not to list page as default..
Thank You,

D
danaci 12/31/2009

create custom button and add onclik code redirection code..

S
Sekaidragon 12/31/2009



Hi,
Please somebody help,
When user click on detail table link at list page at master table (PHP runner automaticaly created it),

i want to redirect it to Add page not to list page as default..
Thank You,


I made and use this function that extracts information from the URL:



if(!function_exists("get_site_info"){

function get_site_info()

{

$script = $_SERVER["SCRIPT_NAME"];

$page = substr($script,strrpos($script,"/")+1);

$site = str_replace($page, '', str_replace('/', '', $script));



$subpages = array('_add.php','_list.php','_view.php','_edit.php','_print.php','_search.php','_export.php','_import.php');

$table = str_replace($subpages,'', $page);
// Example Site: "http://www.yourdomain.com/databasename/tablename_subpage.php";
$database = array();

$database["script"] = $script; // "/databasename/tablename_subpage.php"

$database["page"] = $page; // "tablename_subpage.php"

$database["table"] = $table; // "tablename"

$database["root"] = $site; // "databasename"
return $database;
}} // ... end of function: get_site_info()


Include that function one way or another and insert the following code on the [Before Process] Event of the Child Table:



if($_GET["mastertable"] <> "")

{

$site = array();

$site = get_site_info();
header("Location: ".$site["table"]."_add.php");

exit();

}


When you visit the Child Table, nothing will happen, but if you click a link on the Master Table that opens the List Page of the Child Table, it will automatically re-direct to the Child Table's Add Page.
I hope this is what you were looking for.

D
doykoes author 12/31/2009



I made and use this function that extracts information from the URL:



if(!function_exists("get_site_info"){

function get_site_info()

{

$script = $_SERVER["SCRIPT_NAME"];

$page = substr($script,strrpos($script,"/")+1);

$site = str_replace($page, '', str_replace('/', '', $script));
$subpages = array('_add.php','_list.php','_view.php','_edit.php','_print.php','_search.php','_export.php','_import.php');

$table = str_replace($subpages,'', $page);
// Example Site: "http://www.yourdomain.com/databasename/tablename_subpage.php";
$database = array();

$database["script"] = $script; // "/databasename/tablename_subpage.php"

$database["page"] = $page; // "tablename_subpage.php"

$database["table"] = $table; // "tablename"

$database["root"] = $site; // "databasename"
return $database;
}} // ... end of function: get_site_info()


Include that function one way or another and insert the following code on the [Before Process] Event of the Child Table:



if($_GET["mastertable"] <> "")

{

$site = array();

$site = get_site_info();
header("Location: ".$site["table"]."_add.php");

exit();

}


When you visit the Child Table, nothing will happen, but if you click a link on the Master Table that opens the List Page of the Child Table, it will automatically re-direct to the Child Table's Add Page.
I hope this is what you were looking for.


More question, where i should placing 1 script...?

I'try placing those script, and i get error message..