title: php registration form not submitting values to database and displaying a blank page (no errors)
body: <p>I finally got my registration page to work with no errors but now when I submit the form I just get a blank page with no errors whatsoever. The output should be a message, then i check the database and its still an empty set. Can anyone tell me where I am going wrong/how to fix?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;?php
  require_once __DIR__.'/config.php';
  
  if($_POST[ 'username' ]!="") {
  $username =($_POST["username"]);
  $email =($_POST["email"]);
  $password =($_POST["password"]);
  
  $sql = "insert into users set username='".$username."', email='".$email."', password='".md5($password)."' ";
  $sql =($sql);
  
  
  
  $msg = 'Thank you for completing your online registration form!.';
  }else{
  $msg = "Registration failed";
  }  
  
  ?&gt;
  </code></pre>
  
  <p>EDIT:
  (Based on Yuva Raj answer)</p>
  
  <pre><code>require_once __DIR__.'/config.php';
  session_start();
  
   $connection = mysqli_connect(DB_HOST,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
  
      if(isset($_POST['submit'])) 
     {
      $username =$_POST["username"];
      $email =$_POST["email"];
      $password =$_POST["password"];
  
  
  
      $sql = "insert into users set username='".$username."', email='".$email."', password='".$password."' ";
      $result = mysqli_query($connection, $sql);
  
      if($result)
      {
        echo "successfully inserted";
      }
     else
      {
       echo "failed";
      }
      }
  </code></pre>
  
  <p>I have made some edits but it i sstill displaying blank and not entering anything to the database, I do understand i need to make it more secure, however, for the moment, I just want something to enter so I know it's working.</p>