在PHP $ _POST中使用唯一名称调用文本框

时间:2018-09-07 05:27:52

标签: php loops post get inputbox

我对php真的很陌生,我不确定如何在我的Php帖子中调用每个输入,因为我对输入文本使用了唯一的名称,所以我尝试了 $ serial = $ _POST ['serial'] [$ n];但这不起作用。任何人都可以帮助我..? $ n实际上是根据数据库中的模型区分我的列的东西。我在页面顶部声明了它

     <?php
    mysql_connect("localhost","root","");
    mysql_select_db("pdnoutput");

    date_default_timezone_set("Asia/Kuala_Lumpur");
    $date=date('Y-m-d');
    $datee= $_POST['date'];
    $model= $_GET['model'];
    $lot= $_GET['lot'];

    $num = 1;
    $res = mysql_query("select * from excelsno where lot = '$lot'")or die (mysql_error());

     while($row=mysql_fetch_array($res))
     { 
     $n1=$num++;
     $lotsize = $row['lotsize'];
     $form="QAFG01";
     $dat=date("ymd");
     $idd= "{$dat}{$row['model']}{$row['dest']}{$form}{$row['lot']}";
     $n = "{$row['model']}{$row['dest']}";
     $nom = $row['lot'];
     $nam1 = $row['lotsize'];
     $nam2 =  "{$row['startsno1']}{$row['startsno2']}";
     $nam3 =  "{$row['endsno1']}{$row['endsno2']}";
     $nam4 =  $row['pdate'];
      ?>

    <?php 
    mysql_connect("localhost","root","");
    mysql_select_db("smtform1"); 
    $num = 1;
    $res = mysql_query("select * from speciform where freq = '$lot' AND dstamp >= CURDATE() and nn < 50 ORDER BY id ASC  ")or die (mysql_error());
     while($row=mysql_fetch_array($res))
     {  
     ?>
       <tr>
          <td><?php echo $row['freq'];?></td>
          <td><?php echo $row['dstamp'];?></td>
          <td><input id ="MI" type="text" name="n1" value="<?php echo $num++; ?>" readonly= "readonly" style="width: 22px;"/></td>
          <td><input type="text" name="serial<?php echo $n; ?> " value="<? echo $row['nam5']; ?>"/></td>
          <td><input type="text" name="appereance<?php echo $n; ?>" value="<? **strong text**

    echo

     $row['nam6']; ?>" style="width: 45px;"/>
        </td>
         <td>
          <input type="text" name="sound<?php echo $n; ?>" value="<? echo $row['nam7']; ?>" style="width: 45px;"  />
        </td>
          <td><input type="text" name="wi_test<?php echo $n; ?>" value="<? echo  $row['nam8']; ?>" style="width: 45px;" />
        </td>
          <td><input type="text" name="remark<?php echo $n; ?>" value="<? echo $row['nam9']; ?>"/></td>
        </tr>
     <? } ?> 

这是我的PHP; _

    for($i=1;$i<=$number;$i++)
    {
    $idd= "{$dat}{$row['model']}{$row['dest']}{$form}{$row['lot']}";
         $n1=$_POST['n1'];
         $lotsize=$_POST['lotsize'];
         $n = $_POST['n'];
         $nom =$_POST['nom'];
         $nam1 =$_POST['nam1'];
         $serial[$i]= $_POST['serial'][$n];

        //get the result of the textbox



         $inspector= $_POST['inspector'];

        echo $serial[$i]; 

        $query = mysql_query("update speciform set nam5='$serial[i]',nam10='$inspector' where freq = '$lot' and nn < 50") or die( mysql_error());
    }

0 个答案:

没有答案