This topic is locked
[SOLVED]

 Button to add Detail record while viewing Master

6/22/2012 3:26:52 PM
PHPRunner General questions
F
fmbma author

Lets Say I have a Master/Detail relationship with tables OrderMaster and OrderDetail. While in Edit or View OrderMaster, I would like to have a link or button that goes to the OrderDetail Insert screen. What is the best way to pass the OrderID to the Insert screen, and what would the code be in the Insert (Detail) screen to pick up the OrderID? I want the OrderID to be invisible on the Insert Order detail screen.
Thanks,
Fred

Sergey Kornilov admin 6/22/2012

You can remove OrderID from the Add page. To enable this field being autopopulated with OrderID from master table populate two session variables:

$_SESSION["<table name>_mastertable"] - master table name

$_SESSION["<table name>_masterkey1"] - value of OrderID from master table
<table_name> in this example is details table name

F
fmbma author 6/25/2012

Perfect! thank you!!



You can remove OrderID from the Add page. To enable this field being autopopulated with OrderID from master table populate two session variables:

$_SESSION["<table name>_mastertable"] - master table name

$_SESSION["<table name>_masterkey1"] - value of OrderID from master table
<table_name> in this example is details table name