在php中隐藏表单<input type=hidden>如何使用,最好有个例子

解决方案 »

  1.   

    用法跟普通的表单元素没什么区别,只是不显示出来罢了。
    <input type="hidden" name="text" value="text" />
      

  2.   

    <html>
    <head><title>隐藏表单</title></head>
    <?php
    if (isset($_POST['submit']))
    {
        die("隐藏表单的值是: " . $_POST['hid']);
    }
    ?>
    <form>
    <input type="hidden" name="hid" value="hiddenfield" />
    <input type="submit" value="submit" value="submit" />
    </form>
    </html>
      

  3.   

    同样,在PHP端,也能通过$_GET['test']或者$_POST['test']这样的形式取到值。
      

  4.   

    就是用来通过表单传递参数 只不过不是能看见的控件就是了
    例如:
    从文件1.php中通过表单传递参数到2.php并显示出来1.php:
    <?php
    $a=500
    ?>
    <form action="2.php" method="post">
    <input type="hidden" name="aa1" value="<?php echo $a; ?>" />
    </form>
    2.php:<?php
    echo $aa1;
    ?>就是这样了