页面未提交

时间:2015-02-08 18:46:43

标签: php mysql

此代码用于显示数据和更新数据。当设置查询字符串时,文本框上传和提交按钮也会出现

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project         Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
   <head>
    <meta charset="UTF-8">
    <title></title>
 </head>
 <body>
 <from action="category_listing.php" method="post">
    <table border="5" width="250"> 
    <?php
        $queryy="select COUNT(*) from category";   //count rows
        $results=  mysqli_query($link, $queryy);
        while ($res=  mysqli_fetch_array($results))
        {$total_rows=$res[0];}
         $offset=$total_rows-1;
        $qry="select ID from category LIMIT $offset,1";
        $res=  mysqli_query($link, $qry);
        while ($res2=  mysqli_fetch_array($res))
        {
           $lastvalue=$res2[0];
        }

        $query="select * from category";
        $result=  mysqli_query($link, $query);
        while ($r=  mysqli_fetch_array($result))
        {
            if(isset($_REQUEST['id']) && is_numeric($_REQUEST['id'])     &&      ($_REQUEST['id']>=0 ) && $_REQUEST['id']<=$lastvalue)
              {
                $id=$_REQUEST['id'];
                if($r[0]==$id)
                {
                   $name=$r[1];
                   echo '<tr><td>';
                   echo 'Name';
                   echo '</td>';
                   echo '<td><input type=text value="'.$r[1].'"></td></tr>';
                   echo '<tr><td colspan="2">';
                   echo '<input type="submit" name="btnupdate" value="Update">';
                   echo '<input type="submit" value="Cancel">';
                   echo '</td></tr>';

                }
              }
             else 
            {
                static $var=1;
                if($var==1){echo '<tr><th>ID</th><th>Name</th>     <th>Action</th></tr>';}   //headers of category
                echo "<tr><td>$r[0]</td><td>$r[1]</td>";
                echo "<td><a       href='category_listing.php?id=$r[0]'>Edit</a></td></tr>";
                $var++;
            }
        }

    ?>
    </table>
    <input type="hidden" name="hidden" value="<?php if(isset($id)) echo $id;?>"/>
</from>
</body>
</html>

我只是设置了查询字符串。在URL中设置时。出现文本框,按提交后,页面未提交。

1 个答案:

答案 0 :(得分:3)

更改

<from action="category_listing.php" method="post"> 

<form action="category_listing.php" method="post">

</from></form>