Hello,
I have built a script and what I am trying to do with it is I have a drop down with 20+ units(depts) and once selected it will bring up all records from the lsv table that are from that unit. (table units.unit = lsv.org)
Here is the abbreviated script of the form:
<?
$sql = "
SELECT *
FROM units
ORDER BY unit
";
$result = @($sql,$connection) or die("Couldn't execute query.");
$the_unit = "
<table width=200 cellpadding=2 cellspacing=2 border=0>
<tr>
<td bgcolor=#800000><font size=1 face=arial color=#ffffff>Units</font></td>
</tr>
";
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
$unit = $row['unit'];
$the_unit .= "<tr>
<td bgcolor=#ECDC94><font size=1 face=arial><a href=\"view_singleunit.php?org=$unit\">$unit</a></font></td>
";
}
$the_unit .= "</tr></table>";
?>
Here is the abbreviated output script:
$chk_id = "SELECT org from lsv WHERE org = \"$org\"";
$chk_id_res = @($chk_id,$connection) or die("Couldn't execute query.");
$chk_id_num = mysql_num_rows($chk_id_res);
if ($chk_id_num == "0") {
header("location: $indexurl/index.htm");
exit;
} else {
$sql = "
SELECT *
from lsv
where org = \"$org\"
";
$result = @($sql,$connection) or die("Couldn't execute query.");
while ($row = mysql_fetch_array($result)) {
extract ($row);
}
}
All help will be appreciated...
Thanks
:o) Ivan