欢迎来到代码驿站!

PHP代码

当前位置:首页 > 软件编程 > PHP代码

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

时间:2021-07-12 13:30:26|栏目:PHP代码|点击:
<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']是否被设置

上一篇:PHP文件系统管理(实例讲解)

栏    目:PHP代码

下一篇:PHP PDOStatement::rowCount讲解

本文标题:PHP程序开发范例学习之表单 获取文本框的值

本文地址:http://www.codeinn.net/misctech/156345.html

推荐教程

广告投放 | 联系我们 | 版权申明

重要申明:本站所有的文章、图片、评论等,均由网友发表或上传并维护或收集自网络,属个人行为,与本站立场无关。

如果侵犯了您的权利,请与我们联系,我们将在24小时内进行处理、任何非本站因素导致的法律后果,本站均不负任何责任。

联系QQ:914707363 | 邮箱:codeinn#126.com(#换成@)

Copyright © 2020 代码驿站 版权所有