• PHP程序开发范例学习之表单――获取文本框的值


    简介:这是PHP程序开发范例学习之表单――获取文本框的值的详细页面,介绍了和php,有关的知识、技巧、经验,和一些php源码等。

    class='pingjiaF' frameborder='0' src='http://biancheng.dnbcw.info/pingjia.php?id=343149' scrolling='no'>

      表单在网站中的应用可以说是网站的根基,几乎没有不用表单的网站,还是先回顾一下表单的用法吧

      <form name="form" method="post" action="login.php"></form>

      文本框的用法:

      <input type="text" name="username" />

      其中input类型包括text、password等类型,HTML5新增了很多的input类型,如果想学习这类的知识可以很好的了解一下,因为分的越细,用的越方便。

      

      看看本实例的功能


      填入表单提交后:


      实现代码:

    <table width="283" height="85" border="1" cellpadding="0" cellspacing="0">
    <form name="name1" method="post" action="abc.php">
    <tr>
    <td width="114" height="30" align="center" >管理员:</td>
    <td width="163" height="30" align="center"><input name="username" type="text" /></td>
    </tr>
    <tr>
    <td align="center">密 码:</td>
    <td height="30" align="center"><input name="password" type="password" /></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    <td height="25">&nbsp;&nbsp;<input name="submit" type="submit" value="submit" /></td>
    </tr>
    </form>
    </table>
    <?php
    if(!isset($_POST['submit']))
    return ;
    if($_POST['submit']=='submit'){
    $username = $_POST['username'];
    $password = $_POST['password'];
    }
    echo <<<EOT
    <table width="284" border="1" cellpadding="0" cellspacing="0">
    <tr>
    <td height="25" align="center"> 管理员:$username</td>
    </tr>
    <tr>
    <td height="25" align="center" valign="middle" class="style2">密码:$password</td>
    </tr>
    </table>
    EOT;
    ?>

      使用 isset()函数判断$_POST['submit']是否被设置

    爱J2EE关注Java迈克尔杰克逊视频站JSON在线工具

    http://biancheng.dnbcw.info/php/343149.html pageNo:5
  • 相关阅读:
    (18)随机数
    JMeter 正则表达式提取器(二)
    swiper控件(回调函数)
    移动测试之appium+python 导出报告(六)
    移动测试之appium+python 简单例子(五)
    移动测试之appium+python 入门代码(四)
    移动测试之appium+python 入门代码(三)
    移动测试之appium+python 入门代码(二)
    移动测试之appium+python 环境安装(一)
    网站架构模式(二)
  • 原文地址:https://www.cnblogs.com/ooooo/p/2241995.html
Copyright © 2020-2023  润新知