<?php
$string = "";
$flag = 0;
if(isSet($_POST['inuse']))
{
$string .= "unit.status = 1";
$flag = 1;
}
if(isSet($_POST['notuse']))
{
if($flag)
$string .= " OR ";
$string .= "unit.status = 0";
$flag = 1;
}
if(isSet($_POST['service']))
{
if($flag)
$string .= " OR ";
$string .= "unit.status = 4";
$flag = 1;
}
if(isSet($_POST['scrap']))
{
if($flag)
$string .= " OR ";
$string .= "unit.status = 2";
$flag = 1;
}
if(isSet($_POST['lend']))
{
if($flag)
$string .= " OR ";
$string .= "unit.status = 6";
$flag = 1;
}
if(isSet($_POST['lost']))
{
if($flag)
$string .= " OR ";
$string .= "unit.status = 7";
$flag = 1;
}
// print_r($string);
$units="SELECT unit.serial, unit.descr, category.txt as category, unit.price, unit.delivery, unit.fuck, unit.waranty, status.txt as status FROM unit, category, status WHERE unit.category=category.id AND unit.status=status.id AND (".$string.") ORDER BY unit.id desc";
//echo $units;
?>
<div align="center">
<table width="50%" height="0" border="0" cellspacing="3" cellpadding="3">
<tr>
<form action="
http://10.0.0.97/inventory_pg/index.php?page=2&qu…; method="POST">
<td class="host_bg_ly2">
<input type="checkbox" name="inuse" value="1" <?php if(isSet($_POST['inuse'])) echo "checked=\"checked\""; ?> /> In use
</td>
<td class="host_bg_ly2">
<input type="checkbox" name="notuse" value="0" <?php if(isSet($_POST['notuse'])) echo "checked=\"checked\""; ?> /> Not use
</td>
<td class="host_bg_ly2">
<input type="checkbox" name="service" value="4" <?php if(isSet($_POST['service'])) echo "checked=\"checked\""; ?> /> Service
</td>
<td class="host_bg_ly2">
<input type="checkbox" name="scrap" value="2" <?php if(isSet($_POST['scrap'])) echo "checked=\"checked\""; ?> /> Scrap
</td>
<td class="host_bg_ly2">
<input type="checkbox" name="lend" value="6" <?php if(isSet($_POST['lend'])) echo "checked=\"checked\""; ?> /> Lend
</td>
<td class="host_bg_ly2">
<input type="checkbox" name="lost" value="7" <?php if(isSet($_POST['lost'])) echo "checked=\"checked\""; ?> /> Lost
</td>
<td class="host_bg_ly2">
<input type="textarea"> Search </input>
</td>
<td class="host_bg_ly2" align="center">
<input type="submit" value="OK"/></input>
</FORM>
</td>
</tr>
</table>
</div>
<?php
echo "<table width=\"99%\" height=\"0\" cellspacing=\"2\" cellpadding=\"2\" border=\"0\">";
echo "<TR>";
echo "<TD class=\"menu_background\" COLSPAN=\"9\">";
echo "</TD>";
echo "</TR>";
echo "<tr>";
echo "<td class=\"belka\">Category</td>";
echo "<td class=\"belka\"><B>Description</B></td>";
echo "<td class=\"belka\"><B>Serial no.</B></td>";
echo "<td class=\"belka\"><B>Status</B></td>";
echo "<td class=\"belka\">FV</td>";
echo "<td class=\"belka\">Warranty</td>";
echo "<td class=\"belka\">Delivery</td>";
echo "<td class=\"belka\">Price</td>";
echo "<td class=\"belka\">Action:</td>";
echo "</tr>";
if ($_POST)
{
try
{
$unit = $pdo -> query($units);
$units=$unit->fetchall();
$no=count($units);
echo '</ul>';
}
catch(PDOException $e)
{
echo 'Polaczenie nie moglo zostac utworzone: ' . $e->getMessage();
}
$rowspan_test=false;
foreach ( $units as $row1 )
{
echo "<tr onmouseover='this.className=\"none\"'' onmouseout='this.className=\"\"'>";
echo "<td class=\"host_bg_ly2\">".$row1['category']."</td>";
echo "<td class=\"host_bg_ly2\">".$row1['descr']."</td>";
echo "<td class=\"host_bg_ly2\">".$row1['serial']."</td>";
echo "<td class=\"host_bg_ly2\">".$row1['status']."</td>";
echo "<td class=\"host_bg_ly2\"><center>".$row1['fuck']."</center></td>";
echo "<td class=\"host_bg_ly2\"><center>".$row1['waranty']."</center></td>";
echo "<td class=\"host_bg_ly2\"><center>".$row1['delivery']."</center></td>";
echo "<td class=\"host_bg_ly2\"><center>".$row1['price']."</center></td>";
echo "<td class=\"host_bg_ly2\"><center>Action</center></td>";
}
echo "</tr>";
}
?>
</TABLE>
<BR><BR>