$sql = "INSERT INTO inv1 (name, email)
VALUES ('".$_POST["name"]." , ".$_POST["email"]."')";
Do not concatenate php variables into a database query string. It leaves you vulnerable to SQL injection attacks.
PHP’s mysqli & pdo api’s have a feature called Prepared Statements that you should use instead to be safe: https://www.php.net/manual/en/mysqli.quickstart.prepared-statements.php
My personal opinion is that beginners should do no less than 24 different PDO and mysqli_ tutorials before actually trying to use either in a real project. But if you absolutely must work on a real project while still learning you should use a good database library that handles most of the database work for you and does it safely by using prepared statements internally. My suggestion for beginners is to use Idiorm.
https://idiorm.readthedocs.io/en/latest/models.html#creating-new-records
The idiorm version of this would be something like
<?php
require_once 'idiorm.php';
ORM::configure('mysql:host=localhost;dbname=dbname');
ORM::configure('username', 'username');
ORM::configure('password', 'password');
ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'));
ORM::configure('error_mode', PDO::ERRMODE_WARNING);
$person = ORM::for_table('inv1')->create();
$person->name = $_POST["name"];
$person->email = $_POST["email"];
$person->save();
You should also not put your database username and password in the actual php files or in any file accessible via a url. Use https://github.com/vlucas/phpdotenv#why-env and keep your credentials in a file outside of the website root folder.