ich trage verschiedene sachen ein. Das Formularfeld Leasing soll nicht unbedingt ausgefüllt werden. Jetzt heißt es aber, dass es benötigt wird. woran liegt das??
	
							
						
					PHP-Code:
	
	
if ($btnSubmit) { // the form has been submitted
    $o_s             = validateText("The O.S.", $o_s, 3, 50, TRUE, FALSE);
    $serial_num      = validateText("Serial Number", $serial_num, 1, 50, TRUE, FALSE);
    $hostname        = validateText("Hostname", $hostname,1,20,TRUE,FALSE);
    $leasing         = validateText("Leasing", $leasing,1,20,TRUE,FALSE);
    If ($cboType == "") {
        $strError = "Please select a system type.";
    }
      If($cboAbteilung == "") {
      $strError = "Please select a department.";
      } Else {
      $intAbteilung = $cboAbteilung;
      } 
    if (!$strError) {
        if ($id) {
           $strSQL = "UPDATE hardware SET type='$cboType', serial_num='$serial_num', o_s='$o_s', abteilung_fk='$cboAbteilung', hostname='$hostname', leasing='$leasing' WHERE pk_asset=$id";
           $strNotify = "update";
        } else {
           $strSQL = "INSERT INTO hardware (type, serial_num, o_s, abteilung_fk,hostname) VALUES ('$cboType', '$serial_num', '$o_s','$cboAbteilung','$hostname','$leasing')";
           $strNotify = "insert";
        }
        $result = dbquery($strSQL);
        // if all was sucessfull show terse summary
        header("Location: ./index.php?notify=$strNotify");
    }
} elseif ($id) {
    $strSQL = "SELECT * FROM hardware as h, tblSecurity as s, Abteilung as a where ";
    $strSQL .= "h.abteilung_fk=a.id_abteilung AND h.pk_asset=$id";
    $result = dbquery($strSQL);
    While ($row = mysql_fetch_array($result)) {
       $cboType          = $row["type"];
       $serial_num       = $row["serial_num"];
       $spare            = $row["sparePart"];
       $o_s              = $row["o_s"];
       $cboAbteilung     = $row["abteilung_fk"];
       $hostname         = $row["hostname"];
       $leasing          = $row["leasing"];
    }
}
include "includes/header.inc.php";
declareError(TRUE);
?>
<FORM METHOD="post" ACTION="<? echo $PHP_SELF?>">
<INPUT TYPE="hidden" NAME="id" VALUE="<? echo $id; ?>">
<TABLE border='0' width='500'>
   <TR>
<?
  if ($id)  
?>
   <TR>
      <TD width='150'>System:</TD>
      <TD width='350'>
         <SELECT SIZE="1" NAME="cboType" >
            <OPTION VALUE=''> </OPTION>
             <?
             // Get all hardware types for the drop down menu
             $result2 = dbquery('SELECT * FROM hw_types');
             while ($row2 = mysql_fetch_array($result2)) {
                  echo "   <OPTION VALUE=\"" . $row2['type_pk'] . "\"";
                  if ($cboType == $row2['type_pk']) {
                     echo " SELECTED";
                  }
                  echo ">".$row2['type_desc']."</OPTION>\n";
             }
             ?>
         </SELECT>
      </TD>
       <tr>
       
       
       
<td width='115'>Department:</td>
<td width='300'>
<?
 echo buildAbteilungSelectohneSpare($cboAbteilung, TRUE);
?>
</td>
</tr>
<TR>
      <TD width='150'>Hostname:</TD>
      <TD width='350'><INPUT SIZE="30" MAXSIZE="50" TYPE="Text" NAME="hostname" VALUE="<? echo antiSlash($hostname); ?>"></TD>
   <TR>
   <TR>
      <TD width='150'>Serial Number:</TD>
      <TD width='350'><INPUT SIZE="30" MAXSIZE="50" TYPE="Text" NAME="serial_num" VALUE="<? echo antiSlash($serial_num); ?>"></TD>
   <TR>
      <TD width='150'>OS Running:</TD>
      <TD width='350'><INPUT SIZE="30" MAXSIZE="50" TYPE="Text" NAME="o_s" VALUE="<? echo antiSlash($o_s); ?>"></TD>
   <TR>
   <TR>
      <TD width='150'>Leasing:</TD>
      <TD width='350'><INPUT SIZE="30" MAXSIZE="50" TYPE="Text" NAME="leasing" VALUE="<? echo antiSlash($leasing); ?>"></TD>
   <TR>
      <TD colspan='2'> </TD>
   </TR>
   <TR>
      <TD colspan='2'><INPUT TYPE="submit" NAME="btnSubmit" VALUE="Enter Information"></TD>
   </TR>
</TABLE>
</FORM>
<?
include "includes/footer.inc.php";
?>
 
          
Kommentar