php--isset()在php中用来检测变量是否设置

005.html

 1 <html>
 2 <head>
 3 <title>005</title>
 4 <script type="text/javascript" src="js/jquery.js"></script>
 5 <style>
 6 * {
 7     margin: 0;
 8     padding: 0;
 9 }
10 </style>
11 </head>
12 <body>
13     <form action="005b.php" method="post">
14         用户登录<br/>
15         用户名:<input type="text" name="uname"/><br/>
16         密   码:<input type="password" name="upwd"/><br/>
17         <input type="submit" value="提交"/>
18         <input type="reset" value="重置"/>
19     </form>
20 </body>
21 </html>
22 
23 <script type="text/javascript">
24 </script>

005b.php

 1 <?php
 2 /*
 3  * isset()在php中用来检测变量是否设置,该函数返回的是布尔类型的值,即true/false。
 4  */
 5 
 6 if (isset($_POST)) {
 7     if ($_POST["uname"] == "admin" && $_POST["upwd"] == "admin") {
 8         echo "用户登录成功";
 9     }else{
10         echo "用户登录失败";
11     }
12 }

 

posted @ 2015-09-06 15:35  yuge790615  阅读(237)  评论(0)    收藏  举报