HTML按钮点击问题

时间:2016-06-29 12:28:05

标签: php html css

您好我需要使用php和html创建一个登录页面,下面的代码工作正常,当我登录页面导航到新页面时。

<?php
   include("config.php");
   session_start();

   if($_SERVER["REQUEST_METHOD"] == "POST") {

      // username and password sent from form 

      $myusername = mysqli_real_escape_string($db,$_POST['username']);
      $mypassword = mysqli_real_escape_string($db,$_POST['password']); 

      $sql = "SELECT id FROM FOOTAGE_SCAN_USERS WHERE username = '$myusername' and password = '$mypassword'";
      $result = mysqli_query($db,$sql);
      if (!$result) {
        printf("Error: %s\n", mysqli_error($db));
        exit();
      }
      $row = mysqli_fetch_array($result,MYSQLI_ASSOC);
      $active = $row['active'];

      $count = mysqli_num_rows($result);

      // If result matched $myusername and $mypassword, table row must be 1 row

      if($count == 1) {
         session_register("myusername");
         $_SESSION['login_user'] = $myusername;

         header("location: home.php");
      }else {
         $error = "Your Login Name or Password is invalid";
      }
   }
?>
<html>



   <head>
     <link rel="stylesheet" href="styles.css">
      <title>Login Page</title>

      <style type = "text/css">
         body {
            font-family:Arial, Helvetica, sans-serif;
            font-size:14px;
         }

         label {
            font-weight:bold;
            width:100px;
            font-size:14px;
         }

         .box {
            border:#666666 solid 1px;
         }
      </style>

   </head>

   <body bgcolor = "#FFFFFF">

      <div align = "center">
         <div style = "width:300px; border: solid 1px #333333; " align = "left">
            <div style = "background-color:#333333; color:#FFFFFF; padding:3px;"><b>Login</b></div>

            <div style = "margin:30px">


               <form action = "" method = "post">
                  <label>UserName  :</label><input type = "text" name = "username" class = "box"/><br /><br />
                  <label>Password  :</label><input type = "password" name = "password" class = "box" /><br/><br />
                  <input type = "submit" value = " Submit "/><br />
               </form>

               <div style = "font-size:11px; color:#cc0000; margin-top:10px"><?php echo $error; ?></div>

            </div>

         </div>

      </div>

   </body>
</html>

但现在我需要使用自定义css文件修改页面,尤其是登录输入部分

所以我用

替换登录部分
 <section class="login">
        <div class="titulo">User Login</div>
        <form action="" method="post">
            <input type="text" required title="Username required" placeholder="Username" data-icon="U">
            <input type="password" required title="Password required" placeholder="Password" data-icon="x">

           <input type = "submit" value = " Submit "/><br />
        </form>
    </section>

但是点击登录按钮时没有出现新页面,css文件与此处http://cssdeck.com/labs/simply-login-form相同。

0 个答案:

没有答案