Q:

I can't INSERT INTO after I send data from a js page

This is the code where I start. 
 $('form').on('submit', function(e){
        $.post('sql.php', $(this).serialize());
        $.post('small.php', function(response){
            document.write(response);
        });
        e.preventDefault();
    });

I insert the data in sql.php:
    <? php
    $con=mysqli_connect("localhost", "root", "usbw", "stage");
    $sql="INSERT INTO info (name, lastname, number) VALUES ('$_POST['name']', '$_POST['lastname']' , '$_POST['number']')";
   if (! mysqli_query($con,$sql))
   {
       die('Error: ' .  mysqli_error($con));
   }
    mysqli_close($con);
? >

I don't know what I did wrong but this page doesn't want to insert the data in mysql
I noticed and corrected the missing "," and adjusted the $_POST values but the problem remains.  I checked the console log, but it didn't say anything. 

A:

You need to give the $_POST values in the query as $_POST['keyname'] and not '$_POST[keyname]'.  Or you can assign the $_POST['keyname'] into another variable and substitute that variable in the query. 
$sql="INSERT INTO info (name, lastname, number) VALUES ('".$_POST['name']."', '" .$_POST['lastname']."', '" .$_POST['number']."')";