I created an account on 000webhost to create html page that has a login form. But I am facing errors when i try to connect the form to the database.

Here is the html code:

```
     <html>

   <head>
      <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 method="POST" action="C1.php">
                  <label>UserName  :</label><input type = "text" name = "username" required = "box"/><br /><br />
                  <label>Password  :</label><input type = "password" name = "password" required = "box" /><br/><br />

                  <input type = "submit" name="submit" value = " Login "/><br />

               </form>

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

            </div>

         </div>

      </div>
   </body>
</html>

```

here is my php page

```
       <?php
 session_start();
$servername = "localhost";
$username = "******";
$password = "******";

// Create connection
$database_name = "id2425621_login";
$conn = mysqli_connect($servername, $username, $password, $database_name);

 if (isset($_POST['submit']))
        {     

    $username='king';
    $password='king123';

    $query = mysqli_query($conn, "SELECT * FROM mylogin WHERE username='$username' and password='$password'");
     if (mysqli_num_rows($query) != 0)
    {
     echo "sucess";   
      }
      else
      {
    echo "fail";
    }
    }
    ?>

```

mysql has a table named mylogin and has the values:

```
INSERT INTO `mylogin`(`username`, `password`) VALUES ('king','king123')

```

i couldn't connect to the database,
appreciate ur help in advance

* code updated