I'm generating several dynamic inputs with a foreach. Each input gets its name and id from looping through an array from a text file. 
The form data is then sent to another PHP page to perform some database queries with POST.
The problem I am facing is that each input value returns NULL.
I don't know what is going on, because when I look in the Web Console on the Network tab, I can see the Parameters are being collected.
array.txt
first_name
last_name
occupation
company_name
industry
city
country
countryCode
phone
email
address
stateProvince
postalZipeCode
form.php
//get array of names and ids for inputs
$array = explode("\n", file_get_contents('array.txt'));
//loop through the array
echo '<form method="POST" action="insert.php">';
foreach($array as $input) {
    echo '<label>'.$input.'</label>'
       . '<input type="text" id="'.$input.'" name="'.$input.'" required="required" class="form-control" placeholder="'.$input.'">';  
    echo '<br>';
}
echo '<input type="submit" value="Submit">';
echo '</form>';
Network Tab (web console)
insert.php
if (!empty($_POST)) {
    //get variables
    if (isset($_POST['first_name'])) {
        $first_name= $_POST['first_name']; //1.
    }
    if (isset($_POST['last_name'])){
        $last_name=$_POST['last_name']; //2.
    }
    if (isset($_POST['occupation'])) {
        $occupation=$_POST['occupation']; //3.
    }
    if (isset($_POST['company_name'])) {
        $company_name=$_POST['company_name']; //4 
    }
    if (isset($_POST['industry'])){
        $industry = $_POST['industry']; //5
    }
    if (isset($_POST['city'])) {
        $city = $_POST['city']; //6
    }
    if(isset($_POST['country'])){
        $country=$_POST['country']; //7
    }
    if (isset($_POST['countryCode'])) {
        $countryCode = $_POST['countryCode']; //8
    }
    if (isset($_POST['phone'])) {
        $phone = $_POST['phone']; //9
    }
    if (isset($_POST['email'])) {
        $email = $_POST['email']; //10
    }
    if (isset($_POST['address'])) {
        $address = $_POST['address']; //11
    }
    if (isset($_POST['stateProvince'])) {
        $stateProvince = $_POST['stateProvince']; //12
    }
    if (isset($_POST['postalZipeCode'])) {
        $postalZipeCode = $_POST['postalZipeCode']; //13
    }
    // insert into table 
    $insertProspectQuery = $conn->prepare("INSERT INTO users (first_name, last_name, occupation, company,industry,city,country,countryCode,phone,email,address,stateProvince,postalZipeCode) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?)");
    $insertProspectQuery->bind_param('sssssssssssss',$first_name,$last_name,$occupation,$company_name,$industry,$city,$country,$countryCode,$phone,$email,$address,$stateProvince,$postalZipeCode);        
    $insertProspectQuery->execute();
    $insertProspectQuery->close();
    $ok = 1;
    } else {
        //handle error
    }

