View Full Version : Hyperlink to a record based on the master record's ID

12-13-2006, 12:08 PM

Here I have this website which is keeping contracts and invoices on a MySQL database.
Now, I have a page where the contracts are listed and another one where invoices are listed.

When I'm adding a new invoice I have a dropdown where client_name, contract_number and contract_date are concatenated so I can select the corresponding contract to add the invoice to.

My issue is:
on the contracts list page, I added a link to each contract, "View invoice" which is suppose to display the corresponding invoice.
Can somebody help by telling me how should I format the hyperlink so the correct invoice opens?
Right now I tried with "http://whatever.com/invoice_view.php?id=client (http://whatever.com/invoice_view.php?id=client)" - where client is the name of the field from invoice where those three values above are concatenated - but it returns a view table without any values on it.

Thanks a lot!



12-13-2006, 03:27 PM
Depends on how the script looks for the client. If, f.e. your "invoice_view" pages searches the invoices based on the client ID, and your client id is represented in the php script as $client_id , your link should be http://whatever.com/invoice_view.php?id=$client_id (http://whatever.com/invoice_view.php?id=$client_idt) . Have a look at www.navaldesign.info/therapy2/search.php (http://www.navaldesign.info/therapy2/search.php) Click on "Search Now" whithout selecting anything from the dropdowns (so that all results are displayed) then click on view. I beleive that is excactly what you are after. of course, much depends on your DB structure, which i don't know.