簡介:這是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> </td>
<td height="25"> <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