Location: PHPKode > projects > Network Asset Management Archive > nama/sa.php
<?php
include "connect.php";
$Submit = $_POST['Submit'];
$OWNER = $_POST['OWNER'];
$Delete = $_POST['Delete'];
$now = date("m/j/y h:i:s",time());
if (($Submit == 'Add SA') && ($OWNER != '')) {
    $insertsa = "update OWNER set sa='$now' where serial = '$OWNER';";
//    echo $insertsa;
    ibase_query($dbh, $insertsa);
}

$Deleteem = $_POST['Deleteem'];
$SERIAL = $_GET['SERIAL'];
if (($Deleteem == 'Delete Checked') && ($Delete[0])){
    for ($i=0; $i < sizeof($Delete); $i++) {
       $deletesa = "update owner set sa=null where serial = '$Delete[$i]'";
       ibase_query($dbh, $deletesa);
    }
} 
//if ($SERIAL == '') { 
//    print '<body text="#000000" bgcolor="#FFFFCC" link="#0000EE" vlink="#551A8B" alink="#FF0000">';
//    print 'Please Pick a lab to edit';
//    exit; 
//}
$now = date("j/m/y h:i:s",time());
$stmt = "Select DISPLAY_NAME, email_address, lab, phone, serial, sa FROM owner where sa is not null order by sa descending;";

print '<form name="IASOADD" method="post" action="">';
print '<Select name="OWNER">';
$stmt2 = "select SERIAL, DISPLAY_NAME from OWNER WHERE (PERSON is null) order by DISPLAY_NAME";
$sth2 = ibase_query($dbh, $stmt2);
echo '<option value="">Not Assigned</option>';
while ($row2 = ibase_fetch_object($sth2)) {
   print '<option value="' . $row2->SERIAL . '"';
   if ($row2->SERIAL==$row->OWNER) {
           print "selected "; }
   print '>' . $row2->DISPLAY_NAME . '</option>';
}
print '</select>';
print '<input type="submit" name="Submit" value="Add SA">';

?>
<BR><BR>
<body text="#000000" bgcolor="#FFFFCC" link="#0000EE" vlink="#551A8B" alink="#FF0000">
<table BORDER=3>
<tr ALIGN=CENTER BGCOLOR="#999999">
<td><b><font face="Times New Roman,Times">Name</font></b></td>

<td><b><font face="Times New Roman,Times">Lab</font></b></td>

<td><b><font face="Times New Roman,Times">Phone</font></b></td>

<td><b><font face="Times New Roman,Times">Appointed</font></b></td>

<td><b><font face="Times New Roman,Times">Remove</font></b></td>
</tr>

<?
$sth = ibase_query($dbh, $stmt);
while ($row = ibase_fetch_object($sth)) {

echo '<td>' . $row->DISPLAY_NAME . '&nbsp</td>';
echo '<td><A HREF="mailto:' . $row->EMAIL_ADDRESS . '"&nbsp</a>' . $row->LAB . '</td>';
echo '<td>' . $row->PHONE . '&nbsp</td>';
echo '<td>' . substr($row->SA,0,11) . '&nbsp</td>';
print '<td><input type="checkbox" name="Delete[]" value="' . $row->SERIAL  . '"></td>';
echo '</tr>';
}
echo '</table>';
print '<input type="submit" name="Deleteem" value="Delete Checked">';
print '</form>';
?>

Return current item: Network Asset Management Archive