2017-04-09 4 views
1

Ich möchte Kunde aus dem ausgewählten Formular oder Combobox in anderen Begriffen auswählen. aber das Problem ist, dass das Auswahlformular nicht abfällt, es verdoppelt sich entsprechend der Anzahl der Kunden in der Tabelle, aus der es stammt. Kannst du mir helfen zu verstehen, warum das passiert? Ich bin wirklich beunruhigt darüber. Ich werde den Code und die Bilder unten This is what when there is only one customer in the customer tableThis my problem, the combobox duplicates into two because there are to customers in the customer tableWarum fällt mein ausgewähltes Formular nicht ab?

<?php 
 
\t include('dbconnect.php'); 
 
    include('home.php'); 
 
?> 
 
<?php include('session.php'); ?> 
 
<html> 
 
<head> 
 
    <link rel="stylesheet" href="assets/demo.css"> 
 
    <link rel="stylesheet" href="assets/form-login.css"> 
 
    <link href="assets/css/font-awesome.css" rel="stylesheet" /> 
 
    \t <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> 
 
    \t <link rel="stylesheet" type="text/css" href="css/dataTables.bootstrap.css"> 
 
\t <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script> 
 
    <script type="text/javascript" src="js/jquery.dataTables.js"></script> 
 
    \t <script type="text/javascript" src="js/dataTables.bootstrap.js"></script> 
 
\t 
 

 
\t <title>Stock Out</title> 
 
<style> 
 
    
 
    body 
 
{ 
 
    background:url('img/bg.png'); 
 
     background-repeat:repeat; 
 
} 
 

 

 

 
    p 
 
     { 
 
     color: black; 
 
     font-family: "TekTon Pro", Georgia, Serif; 
 
     } 
 
     a 
 
     { 
 
     color: black; 
 
     font-family: "TekTon Pro", Georgia, Serif; 
 
     } 
 
     \t a1 
 
\t \t \t { 
 
\t \t \t \t color: white; 
 
\t \t \t \t font-family: "Tekton Pro", Georgia, Serif; 
 
\t \t \t } 
 

 

 
    a:hover{text-decoration:none} 
 
    </style> 
 
</head> 
 
<body> 
 
<body> 
 
<center> 
 

 
<div style="margin-left:0px; margin-right:0px;"> 
 
<form action="saveoutstock.php" method="post"> 
 
<table class="table table-bordered" id="tblContact" style="width:100%; background-color:;"> 
 
\t \t \t \t <thead style="background-color:white;"> 
 
\t \t \t \t <th style="text-align:center"><a>CODE</a></th> 
 
\t \t \t \t <th style="text-align:left"><a>NAME</a></th> 
 
\t \t \t \t <th style="text-align:center"><a>ITEMS LEFT</a></th> 
 
\t \t \t \t <th style="text-align:center"><a>PRICE</a></th> 
 
\t \t \t \t <th style="text-align:center"><a>CUSTOMER'S NAME</a></th> 
 
\t \t \t \t <th style="text-align:center"><a>STOCKS TO BE RELEASED</a></th> 
 
\t \t \t \t <th style="text-align:center"><a>AMOUNT TENDERED</a></th> 
 
\t \t \t \t <th style="text-align:center"><a>ACTION</a></th> 
 
\t \t \t \t </thead> 
 
\t \t \t \t <?php 
 

 
\t \t \t \t \t $res=mysql_query("select * from item order by itemcode asc"); 
 
\t \t \t \t \t $itemcode = $_GET['itemcode']; 
 
\t \t \t \t \t while($rowres=mysql_fetch_array($res)) 
 
\t \t \t \t \t { \t \t 
 
\t \t \t \t \t \t \t echo"<tr style='background-color:#F5F5DC;'>"; 
 
\t \t \t \t \t \t \t if($itemcode == $rowres['itemcode']){ 
 
\t \t \t \t \t \t \t \t echo"<input type='hidden' name='price' value='".$rowres['price']."'></input>"; 
 
\t \t \t \t \t \t \t \t echo"<input type='hidden' name='left' value='".$rowres['qty']."'></input>"; 
 
\t \t \t \t \t \t \t echo"<input type='hidden' name='itemcode' value='".$rowres['itemcode']."'></input>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:center'><a>".$rowres['itemcode']."</a></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:left'><a>&nbsp;&nbsp;&nbsp;".$rowres['item_abb']."</a></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:center'><a>".$rowres['qty']."</a></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:left'><a class='icon-usd'></a>"; 
 
\t \t \t \t \t \t \t echo"<a>".number_format($rowres['price']).".00</a></td>"; 
 
\t \t \t \t \t \t \t $result2=mysql_query("select*from customer "); 
 
\t \t \t \t \t \t \t while($row=mysql_fetch_array($result2)) 
 
\t \t \t \t \t \t \t echo"<td><select name='cusname' class='field'><option value='".$row['cuscode']."'>".$row['name']."</option></select></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:center;'><input type='text' style='font-family:tekton pro; text-align:center;' class='field' name='qty' value=''></input></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:center;'><input type='text' style='font-family:tekton pro; text-align:center;' class='field' name='amount' value=''></input></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:center;'><button style='padding:4px 10px; font-family:tekton pro;' class='btn btn-success'><span class='icon-save'></span>&nbsp;&nbsp;Save&nbsp;&nbsp;</button></td>"; 
 
\t \t \t \t \t \t } 
 
\t \t \t \t \t \t else{ 
 
\t \t \t \t \t \t \t echo"<td style='text-align:center'><a>".$rowres['itemcode']."</a></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:left'><a>&nbsp;&nbsp;&nbsp;".$rowres['item_abb']."</a></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:center'><a>".$rowres['qty']."</a></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:left'><a class='icon-usd'></a>"; 
 
\t \t \t \t \t \t \t echo"<a>".number_format($rowres['price']).".00</a></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:center'><a></a></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:center'><a></a></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:center'><a></a></td>"; 
 
\t \t \t \t \t \t \t echo"<td style='text-align:center;'><a style='padding:4px 10px;' href='outstock.php?itemcode=$rowres[itemcode]' class='btn btn-primary'><span class='icon-signin'></span>&nbsp;Stock Out</button></td>"; \t 
 
\t \t \t } \t 
 
\t \t \t \t \t \t \t echo"</tr>"; 
 
\t \t \t \t \t \t } \t 
 
\t \t \t \t \t \t 
 
\t \t \t \t ?> 
 
\t </table> 
 
\t <script type="text/javascript"> 
 
\t \t $(document).ready(function() { 
 
\t \t $('#tblContact').dataTable({ 
 
\t \t \t "iDisplayLength": 10, 
 
\t \t \t \t "lengthMenu": [5,10, 25, 50] 
 
\t \t }); 
 
    \t }); 
 
\t </script> 
 
\t \t </form> 
 
</center> 
 
</body> 
 
<html>

+0

Sie fügen die Auswahlregisterkarte in Ihre Schleife ein. Es sollte vor der Schleife mit der schließenden Auswahl-Registerkarte nach der Schleife kommen. Nur die Option sollte innerhalb der Schleife sein. –

+0

danke @SloanThrasher. . Mein Problem ist gelöst. Danke für die schnelle Antwort –

+0

Wenn es funktioniert, bitte akzeptieren Sie die Antwort. –

Antwort

2

befestigen Weil Sie umfassen die -Tag in der Schleife wählen, es wiederholt sich so erhalten Sie mehrere Drop-downs. Nur die Registerkarte Optionen sollte innerhalb der Schleife sein.

Sie sollten auch zu mysqli anstelle von mysql Funktionen konvertieren. Letztere sind veraltet und veraltet, und sie sind weniger sicher.

Verwandte Themen