searchform mit PHP5 + MySQL

ttabii

Grünschnabel
Hallo leute
ich brauche eure Hilfe , wir haben ein selbst geschriebenes Archiv DB mit Suse Linux 8.2 gehabt , ich musste diesen auf Suse Linux 10.3 Portieren , soweit auch kein Problem nur die "searchform.php" funktioniert nicht mehr . Meldung ist immer "Nichts selektiert !"
Funktion ist via HTML wird ein bis n wert gesucht , z.b. die Maschninen nr. 1234" danach wird dieser wert an "searchform.php" übergeben die dan diesen wert im MySQL DB suchen und ausgeben soll nur klappt das irgend wie nicht. Ich währe für jede Lösung sehr dankbar.

Hier die Quelcode: index.html
PHP:
<html>
<STYLE TYPE="text/css">
BODY {background-image: url(back_home.gif); background-repeat: no-repeat;}
A    {font-family:Verdana,Arial; text-decoration:underline; font-weight:normal}
.titeltext {font-family: Arial; font-style: normal; font-size: 15pt; color: white;}
.hinweis   {font-family: Arial; font-style: normal; font-size:  9pt; color: white;}
.hinweis1  {font-family: Arial; font-style: normal; font-size:  9pt; color: yellow;}
</STYLE>
<BODY onresize="" BGCOLOR="#00018D" TEXT="aliceblue" BGPROPERTIES="FIXED" LINK="#0000FF" VLINK="orangered" ALINK="#FF0000" LEFTMARGIN="20" TOPMARGIN="10" MARGINHEIGHT="10" MARGINWIDTH="20">
<form action=searchform.php method=POST>
<table>
<TR><TD colspan=3><h1>Art 2000 Web-Edition V1.0</H1></TD></TR>
<tr><th colspan=3>Suchen nach</TH></TR>
<TR><TD colspan=3><HR></TD></TR>
<TR><TD>Vertrags-Nummer (*):</TD>
<TD><input type=text name=VNr size=10 maxlength=10></TD></TR>
<TR><TD>Kunden-Nummer:</TD>
<TD><input type=text name=KNr size=10 maxlength=10></TD></TR>
<TR><TD>Maschinen-Nummer:</td>
<TD><input type=text name=MNr size=10 maxlength=10></TD></TR>
<TR><TD> (*) ohne führende 10 eingeben</TD></TR>
<TR><TD colspan=3><HR></TD></TR>
<TR><TD COLSPAN=3>
<center><input type=submit value="suchen"></center>
</TD></TR>
</table>
</form>
</body>
</html>

Hier Quelcode searchform.php
PHP:
<html>
<STYLE TYPE="text/css">
BODY {background-image: url(back_home.gif); background-repeat: no-repeat;}
A    {font-family:Verdana,Arial; text-decoration:underline; font-weight:normal}
.titeltext {font-family: Arial; font-style: normal; font-size: 15pt; color: white;}
.hinweis   {font-family: Arial; font-style: normal; font-size:  9pt; color: white;}
.hinweis1  {font-family: Arial; font-style: normal; font-size:  9pt; color: yellow;}
</STYLE>
<BODY onresize="" BGCOLOR="#00018D" TEXT="aliceblue" BGPROPERTIES="FIXED" LINK="#0000FF" VLINK="orangered" ALINK="#FF0000" LEFTMARGIN="20" TOPMARGIN="10" MARGINHEIGHT="10" MARGINWIDTH="20">
<?php
parse_str($HTTP_SERVER_VARS['QUERY_STRING']);
// Verbindung zu DB aufbauen
mysql_connect (localhost);
mysql_select_db (Art);
// schauen, ob neue Dokumente gescannt wurden...
if (is_file("/archdoc/sdb/import.txt")) {
// ... und diese dann in die DB importieren
    if (is_file("/archdoc/sdb/import2.txt")) unlink("/archdoc/sdb/import2.txt");  // altes import2.txt löschen
//  copy("/archdoc/import.txt", "/archdoc/sdb/import2.txt");
    rename("/archdoc/sdb/import.txt", "/archdoc/sdb/import2.txt");                // import.txt umbenamsen auf import2.txt
    $fimport = file("/archdoc/sdb/import2.txt");                     // einlesen des Files
    while (list ($line_num, $line) = each ($fimport)) {
          if (substr($line, 0, 4) == "ZVE ") {          // nur ZVE-Records abarbeiten
             $sql  = "insert into Docs values (" . substr($line, 4, 9) . ", 0";
             $sql .= ", '" . str_replace('\\', '/', substr($line, 86)) . "'";
             $sql .= ", '" . substr($line, 45,40) . "');";
             if (mysql_query($sql) == false) {
                echo "<b>Error in Line $line_num:</b>; ", htmlspecialchars ($sql), "<br>\n";
                }
             $result = mysql_query("SELECT * FROM VKM WHERE VNr = " . substr($line, 4, 9) . ";");
             if (mysql_num_rows($result) == 0) {
                $sql  = "insert into VKM values (" . substr($line, 4, 10) . ", ";
                $sql .= "0" . substr($line, 15, 10) . ", ";
                $sql .= "0" . substr($line, 26, 18) . ",'' ,'OSI-Vertrag' );";
                if (mysql_query($sql) == false) {
                   echo "<b>Error in Line $line_num:</b>; ", htmlspecialchars ($sql), "<br>\n";
                   }
                }
             }
          }
    };
// fertig mit dem importieren von neuen Dokumenten
// suchen nach Vertragsnummer
if ($VNr <> ""){
   $result = mysql_query ("SELECT * FROM Docs WHERE VNr = '$VNr%';");
   if ($row = mysql_fetch_array($result)) {
// mindestens 1 Eintrag gefunden
	if (mysql_num_rows($result) > 1) {	
	    // mehr als 1 Eintrag
?>
<TABLE height=100% width=100% BORDER="1">
	<TR><TD>
Resultate zu Vertrag <?php $VNr ?><P>

<form name="selectform" method="POST">
  <font face="helvetica, arial, geneva" size="-1">Auswahl: </font>
  <select size="1" name="fileselect"
          onChange="document.selectform.filename.value=document.selectform.fileselect.options[document.selectform.fileselect.selectedIndex].value ; document.TiffyApplet.loadImage(document.selectform.filename.value); return true;">
<?php  do {
         $Files = 'docs/' . $row["File"];
//       print "<P><a href=document.selectform.filename.value=document.selectform.fileselect.options[document.selectform.fileselect.selectedIndex].value ; document.TiffyApplet.loadImage(" . $row["File"] ."); return true;" . ">";
//       print $DokNr . " " . $row["Desc"] . "<BR>";
         

         print '<option selected value="';
         print 'docs/' . $row["File"];
         print '"> ';
//  print $row["DNr"];
         $DokNr = $DokNr + 1;
         print $DokNr;
         print (" ");
         print $row["Desc"];
         print '</option>';

        } while($row = mysql_fetch_array($result));
      
?>
</select>
<input type="hidden" name=filename value="images/00441.tif">&nbsp;
</form>
<?php
       } else {
           //nur 1 Eintrag gefunden
         $Files = 'docs/' . $row["File"];
         }
?>
	</TD>

	<TD width=100% height=100%>
<applet code="TiffyApplet.class" codebase="./" archive="Tiffy.jar"
        width="100%" height="100%" name=TiffyApplet ID=TiffyApplet>
<param name="cabbase" value="Tiffy.cab">
<param name="Filename" value="<?php print $Files; ?>">
<param name="Options" value="/save /fh">
<!-- Fuer die Attribute width und height koennen auch prozentuale Werte angegeben werden, dies funktioniert -->
<!--  jedoch nicht mit jedem AppletViewer/Browser. -->
<!-- Falls der Aufruf aus einem anderen Pfad heraus erfolgt,  -->
<!-- setzen Sie bitte ggf. das codebase-Attribut entsprechend -->
<!-- In order to allow a permanent download of the applet class packages with MS Internet Explorer, -->
<!-- you may add the following parameter lines inside the applet tags: -->
<param name="useslibrary" value="Tiffy">
<param name="useslibrarycodebase" value="Tiffy.cab">
<param name="useslibraryversion" value="2,5,4,0">
<!-- where [AppletVersionCommaSeparated] is to be replaced by the current version of the applet. -->
<!-- For example if 2.5.3 is the current version of the applet, you would replace this placeholder by "2,5,3,0". -->

Für diese Anwendung ist ein Java f&auml;higer Browser erforderlich.
Der verwendete Browser ist nicht Java-tauglich oder die Java Unterst&uuml;tzung
ist deaktiviert. Netscape Navigator oder Microsoft Internet Explorer Version 3.0
oder h&ouml;her bieten die ben&ouml;tigte Funktionalit&auml;t.
</applet>
</TD></TR></TABLE>
<?php
}
     // keine Verträge gefunden
     else {print "Keine Eintr&auml;ge gefunden!";}
}
 else {
  if ($KNr == "" and $MNr == "")
   {print "Nichts selektiert !";} else
   {
    if ($KNr <> "")
     {$result = mysql_query ("SELECT * FROM VKM WHERE KNr = '$KNr%' order by VNr;");}
    else
     {$result = mysql_query ("SELECT * FROM VKM WHERE MNr = '$MNr%' order by VNr;");}

    if ($row = mysql_fetch_array($result)) {
?>
<H1>Gefundene Vertr&auml;ge</H1>
<table>
  <TR>
    <TH>Vertrags-Nr.</TH></TH><TH>Ger&auml;te-Nr.<TH>Ger&auml;te-Typ</TH>
  </TR>
<TR><TD colspan=3><HR></TD></TR>
<?php
    do {
        print "<TR><TD>";
        $Files = 'docs/' . $row["FILENAME"];
        $result2 = mysql_query ("SELECT * FROM Docs WHERE VNr = '" . $row["VNr"] . "';");
        if ($row2 = mysql_fetch_array($result2)) {
           print '<A HREF="searchform.php?VNr=';
           print $row["VNr"];
           print '"> ';
           print $row["VNr"];
           print ("</A>  ");}
          else {
           print $row["VNr"];
           print ' ';
        }
        print "</TD><TD>";
        print $row["MNr"];
        print "</TD><TD>";
        print $row["MAKTX"];
        print '</TD></TR>';
       }while($row = mysql_fetch_array($result));
?>
<TR><TD colspan=3><HR></TD></TR>
<TR><TD colspan=3><a href="index.html">zur&uuml;ck</A></TD></TR>
</TABLE>
<?php
}
     // keine Verträge gefunden
     else {print "Keine Eintr&auml;ge gefunden!";}

}
  }

?>


</body>
</html>

Was ist da falsch

Danke für eure Lösungs vorschläge

Gruss
 
Zurück