I am trying to create a simple website where someone inputs some information in an html form and with php prepared statements the info gets inserted into my database. Although I have checked a lot of times that my inputs are correct and I get no sql errors the data do not get inserted into my database. Can anyone help find out what goes wrong?
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$dbServername="localhost";
$dbUsername="root";
$dbPassword="";
$dbName="console";
$conn=mysqli_connect($dbServername,$dbUsername,$dbPassword,$dbName);
if(isset($_POST['submit'])){
    $last=$_POST['lastname'];
    $first=$_POST['firstname'];
    $tel1=$_POST['tel1'];
    if(empty($_POST['tel2'])){ 
        $tel2=null;
    }else{
        $tel2=$_POST['tel2'];
    }
    $address=$_POST['ad'];
    $postcode=$_POST['postcode'];
    $city=$_POST['city'];
    $email=$_POST['email'];
    $job=$_POST['job'];
    $sql = "INSERT INTO customers (tel1,tel2,postcode,lastname,firstname,ad,city,email,job) VALUES (?,?,?,?,?,?,?,?,?)";
    $stmt=mysqli_stmt_init($conn);//create prepared statement
    if (!mysqli_stmt_prepare($stmt,$sql)){  //check if the prepared statement was succesfully prepared
        header("Location: ../necustomer.php?error=sqlerror");
        exit();
    }else{
  mysqli_stmt_bind_param($stmt,"iiissssss",$tel1,$tel2,$postcode,$last,$first,$address,$city,$email,$job); //bind the parameters with the placeholders
    mysqli_stmt_execute($stmt);
    }
     header("Location: ../necustomer.php?signup=success");
}else{
header("Location: ../necustomer.php");
  }
This is my php file.
