
Jag skapar en tabell från denna fil:
Kod: Markera allt
*$SY100 $L01$F001$T001$B00000010$I001$G00101$R00000000$O01$NPATCH KABEL ORA 2M $
*$SY101 $L01$F001$T001$B00000018$I001$G00101$R00000000$O01$NLASTBARARE SVART $
*$SY102 $L01$F001$T003$B00000012$I001$G00101$R00000000$O01$NPATH KABEL GRA 1M $
*$SY103 $L01$F001$T004$B00000006$I001$G00101$R00000000$O01$NATERSTALL KNAPP $
Så det jag undrar är hur kan man få kopplingen mellan art_no och quantity från dom raderna som det finns ett ifylt värde i ??
Det kommer ju bli en array med infon men hur får man till det ???
Kod: Markera allt
<?php
echo "<form action='' method='post'>";
echo "<table>
<tr>
<th scope='col' >Art No</th>
<th scope='col' >Avalible Quantity</th>
<th scope='col' >Quantity</th>
</tr>";
$file1 = "/srv/ftp/inBox/amdbackup.amd";
$lines = file($file1);
foreach($lines as $line_num => $line){
$rows = explode("\$",$line);
$article_no = substr ($rows['1'],1);
$avalible_quantity = ltrim (substr ($rows['5'],1),0);
echo "<tr>";
echo "<td>" . $article_no . "</td>";
echo "<td>" . $avalible_quantity . "</td>";
echo "<td>" . "<input size='2' type='text' name='q'></input>" . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<input name='add' type='submit'><br>";
echo "</form>";
if (IsSet($_POST['add'])) {
$art_no=$_POST['id'];
$quantity=$_POST['q'];
echo "art_no" . $art_no;
echo "</br>";
echo "quantity" . $q;
echo "</br>";
/Andreas H