title: Get and insert Data into MySQL database using PHP with xampp on localhost
body: <p>I have managed to connect to database and I manage to insert using following code.</p>
  
  <pre><code>&lt;?php
  
  $username = 'root';
  $password = '';
  $db = 'demo';
  
  $conn = new mysqli ('localhost',$username, $password, $db) or die("unable to connect");
  
  $sql="insert into persons (first_name,last_name,email_address) values ('sara','smith','email@email.com')";
  $query=mysqli_query($conn,$sql);
  if($query)
      echo 'data inserted';
  ?&gt;
  </code></pre>
  
  <p>But the problem is that when I try to enter data using HTML form, it didn't work for me. I have tried to follow different tutorials and different answers here on stackoverflow. Can anyone please tell me the easiest way of inserting and getting data from MySQL using PHP ?</p>
  
  <p>If there is any easy tutorial or blog from where i can learn and understand all this, I would love to watch or read.</p>