This topic is locked

master-detail add

12/8/2007 11:33:13 AM
PHPRunner General questions
G
garethp authorDevClub member

Thanks for previous response but I am having a problem with one element.
I am trying to create a order entry process and have 2 tables - so_header and so_details (master-details set up)
so_header has the following fields - order_no, customer

so_details has the following fields - id, order_no (link back to master), part
When I click "save" in the "add new" so_header screen can I be taken to the so_details_list screen for the order jsut created? I realise there will be no so_details entries at this time but when the user click add I require the just added order_no to be remembered. I can do a redirect to sor_details_list.php as an after record added in the so_header_add screen but the masterkey(?) is not remembered
In a previous response I was told to before redirecting to details table save master key info in session variables

$_SESSION["so_details_mastertable"]="so_header";

$_SESSION["so_details_masterkey1"]=$keys["order_no"];
I have tried this as an after record addedevent on so_header_add as follows but with no success

//** Custom code ****

// put your custom code here
$_SESSION["so_details_mastertable"]="sor_header";

$_SESSION["so_details_masterkey1"]=$keys["order_no"];
//** Redirect to another page ****

header("Location: so_details_list.php");

exit();


I have tried everything I can think of to make it work but thought best to ask someone who might actually know!! Many thanks

Alexey admin 12/10/2007

Hi,
either redirect directly to the Add page

header("Location: so_details_add.php");

or use this line to redirect to List:

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