title: php mysql forms validation
body: <p>i already got message in my browser </p>
  
  <blockquote>
    <p>Notice: Undefined variable: password in C:\xampp\htdocs\udemy\mysql\login.php on line 8 pls insert username and password</p>
  </blockquote>
  
  <p>even i haven't submitted the form. </p>
  
  <p>One more question how can i validate if the username and the password are submit with text.</p>
  
  <pre><code>&lt;?php
  
  if(isset($_POST['submit'])){
  $username = $_POST['username'];
  $password = $_POST['password'];
  }
  
  if($username &amp;&amp; $password){
      echo $username;
  
      echo $password;
  }else{
      echo "pls insert username and password";
  }
  
  
  ?&gt;
  
  
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Document&lt;/title&gt;
  &lt;link rel="stylesheet"
  href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"
  &gt;
  &lt;/head&gt;
  &lt;body&gt;  
  &lt;div class="container"&gt;
  
      &lt;div class="col-sm-6"&gt;
          &lt;form action="login.php" method="POST"&gt;
              &lt;div class="form-group"&gt;
                  &lt;label for="username"&gt;Username&lt;/label&gt;
                  &lt;input type="text" name="username"
                  class="form-control"&gt;
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  &lt;label for="username"&gt;Password&lt;/label&gt;
                  &lt;input type="password" name="password"
                  class="form-control"&gt;
              &lt;/div&gt;
  
              &lt;div class="form-group"&gt;
                  &lt;input type="submit" name="submit"
                  class="btn btn-primary"&gt;
              &lt;/div&gt;
  
          &lt;/form&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>