This topic is locked

Add in Child Table link on Master List Page

11/17/2008 4:41:22 PM
PHPRunner General questions
hfg author

I have a master table of Customers which a child table of Notes.
I want to give my users a very quick way of adding notes from the Master list page.
I've tried:
Event List After Record Processed
$row["ID_clean"]=$data["ID"];
then in visual editor
<A href="apps/traffic/notes_add.php?masterkey1={$ID_clean}">Add Note</A>
This does not work, I always get the masterkey for the 1st item in the master table list.
Thanks

J
Jane 11/18/2008

Hi,
try to use this one:

global $record;

$record["ID_clean"]=$data["ID"];

hfg author 11/20/2008

Unfortunately that didn't work
If my link correct?
<A href="apps/traffic/notes_add.php?masterkey1={$ID_clean}">Add Note</A>
It opens the Add screen but the Customer ID is always the same and not the one that I choose.
For example in the address bar I have this (which displays the correct master key)
http://XX.XX.XX.XX/apps/traffic/notes_add....masterkey1=6756
But the Cust ID (the foreign key) is always 6750
Thanks

J
Jane 11/20/2008

It's difficult to tell you what's happening without seeing actual files.
Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.

hfg author 11/20/2008

Unfortunately due to the confidential nature of the database I can't upload it.
I will try to explain better.
Two tables
Customer

ID

name

etc
notes

ID

Cust_ID

note
I want to give my users one click access to add a new note for a customer, rather than clicking on a Notes link in the Customer_List page and then clicking Add New.
In an attempt to do so I put the following link on the customer_list.php page
<A href="apps/traffic/notes_add.php?masterkey1={$ID_clean}">Add Note</A>
where the ID_clean is generated on events
global $record;

$record["ID_clean"]=$data["ID"];
When you click on the linke the correct ID is shown in the Address Bar, but not on the add notes screen
The notes_add.php Cust_ID is either blank or the ID of the last customer you went to notes_list.php
Is there a way to send notes_add.php the Cust_ID of the customer that you clicked on a link on the customer_list.php?
I hope that makes sense.

J
Jane 11/21/2008

Hi,
I see what you're saying.

You need to fill session variable in the Add page: Before process event:

global $strTableName;

if (@$_REQUEST["masterkey1"])

{

$_SESSION[$strTableName."_mastertable"] = "Customer";

$_SESSION[$strTableName."_masterkey1"] = $_REQUEST["masterkey1"];

}

G
gdkoduro 11/22/2008

Hi,

I see what you're saying.

You need to fill session variable in the Add page: Before process event:


Hi hfg,

Did this solution work for you? Do let me know if it did as I have been looking out for something similar for last few months on this forum. Thanks.
d_arkw_a

hfg author 11/22/2008

It worked exactly as I wanted.
Thanks Jane