0

我试图修复这个简单的网页。

我从这个文件做一个表:

*$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 $

并想使用文本字段来获取“数量”如何在 post 命令中获取这些行?

<?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'></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" . $quantity;
echo "</br>";
4

1 回答 1

0

好吧,我认为我之前的回答是不正确的。此外,我没有看到任何名为idq在您的form.

你可能想更换

<input size='2' type='text'></input>

<input size='2' type='text' name='q' />

虽然您将不得不添加另一个字段id

于 2013-05-26T18:37:09.377 回答