This topic is locked

Master/Detail redirect problem

3/14/2010 9:16:35 PM
PHPRunner General questions
N
nix386 author

Hi all, just wondering if anyone might be able to assist me? I've been working on a ticket system using master/detail relationship and this is working fine, however I have found that the extra steps required by default are a little cumbersome if not confusing for the target audience. Currently the user has a customer list page with detail link to add a ticket. When the user clicks this detail link I want to check if a ticket already exists for this customer; If a ticket exists it will display the master/detail list view for that customer. If no ticket exists I want to redirect to the add a new entry which is achieved with the code below however, it's not filling or has the incorrect session data for the two fields via session variable on the Add Page (see below) The Add page contains variables as "default" for these fields and I cannot work out whats going wrong... it's almost like the BeforeProcessAdd Event is skipped during the redirect from the master table? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=14048&image=1&table=forumtopics' class='bbc_emoticon' alt=':blink:' />
Any help would be greatly appreciated.
BeforeProcessList (on detail list page)



global $conn, $strTableName;

if (@$_REQUEST["masterkey1"])

{

$str = "select * from ticket_table where CustomerEdi='".$_REQUEST["masterkey1"]."'";

$rs = db_query($str,$conn);

if ($data = db_fetch_array($rs))

{

//********** If a ticket exists ************

//header("Location: ticket_table_view.php?editid1=".$data["TicketID"]);

header("Location: ticket_detail_table_list.php?mastertable=ticket_table&masterkey1=".$data["TicketID"]);

exit();

}

else

{

//********** Redirect to another page ************

header("Location: ticket_table_add.php?mastertable=customer_table&masterkey1=".$_REQUEST["masterkey1"]);

exit();

}

}


BeforeProcessAdd (on detail add page)



//Get some session variables

global $conn, $strTableName;

if ($_SESSION[$strTableName."_masterkey1"])

{

$sql = "select * from customer_table where CustomerEdi = '".$_SESSION[$strTableName."_masterkey1"]."'";

$rs = db_query($sql,$conn);

$data = db_fetch_array($rs);

$_SESSION["CustomerName"] = $data["CustomerName"];

$_SESSION["CustomerEdi"] = $data["CustomerEdi"];

}

Sergey Kornilov admin 3/16/2010

If you still need help with this post your application to Demo Account (last tab in PHPRunner) and open a ticket at

http://support.xlinesoft.com sending your Demo Account URL.