I have a page that updates a row in my table.
After the update I want to hold the $idx (key_id) so I can pass it to a third php page which uses the idx to query the database and print the row to an html form
Here's my code so far:
.....percentadjust2='$percentadjust2', other='$other', other2='$other2', other3='$other3', other4='$other4', pcode='$pcode', type='$type', houseangled='$houseangled' WHERE contract_num=$idx";
$result = mysql_query($update) or die("Update failed");
(I'm assuming I need some code in here to recall or hold the Contract_num($idx) so that when the user clicks on the print icon below, it calls contract_print.php and uses the idx to query the database. I don't know how to do this part.)
print "Your contract has been updated, however the print feature is temporarily unavailable, to print your contract please search for the contract number and click on the printer icon <b><font size=3>";
print "<font size=2><a href='../forms/contract_print.php?idx=";
print $line["contract_num"];
print "'target=_blank>";
print "<img src=../images/printer_icon.jpg border=0 alt='Print job' /img>";
print "</a></font>";
Here is the code for the contract_print.php:
<?php
import_request_variables("Pg");
/ Connecting, selecting database /
$link = mysql_connect("192.168.2.10", "root")
or die("Could not connect");
mysql_select_db("HDSplans") or die("Could not select database");
/* Performing SQL query */
$query = "SELECT * FROM contract,client WHERE contract_num = $idx AND contract.client_id = client.client_id";
$result = mysql_query($query) or die("Query failed");
$line = mysql_fetch_array($result, MYSQL_ASSOC);
/* Free resultset */
mysql_free_result($result);
?>
Aany suggestions would be appreciated!!