Home  >  Article  >  Backend Development  >  PHP program development example learning form to obtain the value of the text box

PHP program development example learning form to obtain the value of the text box

高洛峰
高洛峰Original
2017-01-11 16:33:421466browse

28aa4dd793bda6b50778225e6e6f9cc0f5a47148e367a6035fd7a2faa965022e
Usage of text box:
3dc9508ed799d3755d10ad4fc071fc5f
The input types include text, password and other types. HTML5 has added many new input types. If you want to learn this kind of knowledge, you can have a good understanding of it, because the more detailed it is, the more The more convenient it is.
 
Take a look at the functions of this example

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

After filling in the form and submitting it:

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

Implementation code :

<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> </td> 
<td height="25">  <input name="submit" type="submit" value="submit" /></td> 
</tr> 
</form> 
</table> 
<?php 
if(!isset($_POST[&#39;submit&#39;])) 
return ; 
if($_POST[&#39;submit&#39;]==&#39;submit&#39;){ 
$username = $_POST[&#39;username&#39;]; 
$password = $_POST[&#39;password&#39;]; 
} 
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; 
?>

Use the isset() function to determine whether $_POST['submit'] is set

For more PHP program development example learning forms to obtain the value of the text box, please pay attention to PHP Chinese for related articles net!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn