title: PHP script to connect to SQL
body: <p>I am at learning stage of PHP. I am using a php file to process form data for sql table and it has server name, user, password and dbname to perform sql-connect query. And of course it is in public directory of website. Is it a safe way or any suggestion is appreciated. example is as follow:</p>
  
  <pre><code>$name = $_POST['name'];
  $phn = $_POST['phn'] ;
  
  $servername = "localhost";
  $username = "abc";
  $password = "abc";
  $dbname = "abc";
  
  // Create connection
  $conn = mysqli($servername, $username, $password, $dbname);
  </code></pre>