Jump to content

Hyperlink to a record based on the master record's ID


sieg

Recommended Posts

Hello,

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" - where [b]client[/b] 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!

Cheers!

Sieg
When calling that page, ?id=client, the form is going to process and pull the information from the database from the variable 'id' matches the 'client'

Do you have a snippet of your code?

Here's  a snippet of one of my codes:
[code]
$sql = "SELECT * FROM database WHERE client = '$id'";
$result = mysql_query($sql);

echo "<table border='1' width='100%'>";
echo "<tr><th>Client</th><th>ID</th></tr>";

while($row = mysql_fetch_array( $result )){

echo "<tr><td valign=\"top\">";
echo "$row[client] ";
echo "</td>";
echo "<td>";
echo "$row[id] </td>";
echo "</tr>";
}
echo "</table>";

[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.