title: Insert data into table using php
body: <p>My html form is like below: </p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;form action="createconnection.php" method="post"&gt;
  
  Firstname : &lt;input type="text", name="fname"&gt; &lt;/br&gt;
  Lastname : &lt;input type="test" name="lname"&gt; &lt;/br&gt;
  Age : &lt;input type="text" name="age"&gt;&lt;/br&gt;
  
  &lt;input type="submit"&gt;
  
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and php file:
  Table name and db name all are fine.</p>
  
  <pre><code>&lt;?php
  // Create connection
  
  $con=mysqli_connect('127.0.0.1:3306' ,'root','root','my_db');
  echo "hi";
  if (mysqli_connect_errno())
    {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
  
  $sql="INSERT INTO table1 (Fname, LName, Age)
  VALUES
  ('$_POST[fname]','$_POST[lname]','$_POST[age]')";
  
  if (!mysqli_query($con,$sql))
    {
    die('Error: ' . mysqli_error($con));
    }
  echo "1 record added";
  
  mysqli_close($con);
  ?&gt; 
  </code></pre>
  
  <p>I tried very much but when I execute it gives nothing and no update in table. </p>