title: Insert mysql data via a php form on the same page?
body: <p>I am looking to insert the data from the php form in to the mysql database via the PHP code located on the same page.</p>
  
  <pre><code>&lt;?php
  if (isset($_POST['submit'])){
  $con=mysqli_connect("localhost","root","********","*********");
  $sql="INSERT INTO drafts (id, title, description, post, author, category, declined)
  VALUES
  ('','$_POST[title]',$_POST[description],$_POST[post],$_POST[author],$_POST[category],0)";
  echo "Droplet Successfully Added!";}
  ?&gt;
  
  &lt;form action="create-post.php" method="post"&gt;
    Title: &lt;br /&gt;&lt;input type="text" name="title"&gt;&lt;br /&gt;&lt;br /&gt;
    Description: &lt;br /&gt;&lt;textarea name="description"&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;
    Post: &lt;br /&gt;&lt;textarea name="post"&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;
    Author: &lt;br /&gt;&lt;input type="text" name="author"&gt;&lt;br /&gt;&lt;br /&gt;
    Category: &lt;br /&gt;&lt;input type="text" name="category"&gt;&lt;br /&gt;&lt;br /&gt;
    &lt;input class="btn btn-info" type="submit" value="Submit for review"&gt;
  &lt;/form&gt;
  </code></pre>