aqui é no registration.php
<?php
include_once("connection.php");
if (isset ($firstname)|| isset ($surname) || isset($email)){
$firstname=$_POST['firstname'];
$surname=$_POST['surname'];
$email=$_POST['email'];
$sql="INSERT INTO leadcapture(nome , sobrenome, email) VALUES('$firstname', '$surname','$email' ) ";
if(mysqli_query($connection, $sql)){
echo "Usuario cadastrado com sucesso";
}else{
echo "erro".mysqli_connect_error($connection);
}
mysqli_close($connection);
}
?>
no html index.html
<form action="registration.php" method="POST" class="form" id="form">
<div class="form-control">
<label for="firstname" >Nome</label>
<input type="text" name="firstname" id="firstname" placeholder="digite seu nome">
</div>
<div class="form-control ">
<label for="surname" >Sobrenome</label>
<input type="text" name="surname" id="surname" placeholder="digite seu sobrenome" >
</div>
<div class="form-control ">
<label>E-mail</label>
<input type="email" name="email" id="email" placeholder="digite seu melhor e-mail :)">
</div>
</form>
vou colocar o codigo aqui é de um formulario simples
aqui eu criei arquivos separados
no connection.php
<?php
if (isset ($firstname)|| isset ($surname) || isset($email)){
$dbHost = "Localhost";
$dbUsername = "root";
$dbPassword = "";
$dbName="formulario" ;
$connection=mysqli_connect($dbHost , $dbUsername , $dbPassword , $dbName);
if($connection ->connect_errno){
echo "erro";
} else{
echo "sucesso";
}
if(!$connection){
die("houve erro".mysqli_connect_error());
}
}
?>