2013-05-26 46 views
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 $

,并希望使用文本字段获得“量”怎么我怎么得到它这个排在后命令?

<?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>"; 

回答

0

嗯,我想我以前的答案是不正确的。另外,我的form中没有看到idq的字段。

你可能想用

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

更换

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

虽然你将不得不添加一个字段为id

+0

我只是检查,它似乎并不重要,PHP将接受这两个关键指标。我删除了我的评论,上面提供了相同的建议。 –

+0

@CodyCaughlan:哦谢谢..我认为这可能是我编辑的答案之外的问题 – draxxxeus

+0

是的,我已经尝试过,但我不明白我是如何得到物品号和数量之间的连接? – Pixiandreas