I am really struggling with this issue and can't solve this one, I am trying to add a customer into a database using php but each time I click submit, it does not redirect to my view all customers page and just shows a white page and on the error log shows the following
[15-Jan-2020 23:49:25 UTC] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/itdonerightco/public_html/admin/add-customer.php:12) in /home/itdonerightco/public_html/admin/add-customer.php on line 86
[15-Jan-2020 23:49:56 UTC] PHP Warning: mysqli_stmt::execute(): (HY000/1364): Field 'user_pass' doesn't have a default value in /home/itdonerightco/public_html/admin/add-customer.php on line 69
The first error I am not too worried about as don't think that would prevent the insertion of the data to the database but think it's the second error that is preventing data being added to the database and is the one I am most confused about as I am not wanting to add a password in the database, I just want to add name, email, phone and username
The code I have is below
 <?php
   if (isset($_POST['submit']))
      {
        // get the form data
        $customer_name = htmlentities($_POST['customer_name'], ENT_QUOTES);
        $customer_email = htmlentities($_POST['customer_email'], ENT_QUOTES);
        $customer_phone = htmlentities($_POST['customer_phone'], ENT_QUOTES);
        $username = htmlentities($_POST['user_name'], ENT_QUOTES);
        // check that firstname and lastname are both not empty
        if ($customer_name == '' || $customer_phone == '' || $username == '')
        {
            // if they are empty, show an error message and display the form
            $error = 'ERROR: Please fill in all required fields!';
            renderForm($customer_name, $customer_phone, $username, $error);
        }
        else
        {
            $stmt = $mysqli->prepare("SELECT count(*) as user_exist FROM users WHERE (customer_name=? and customer_name!='') or (customer_email=? and customer_email!='') or (user_name=? and user_name!='')");
                $stmt->bind_param("sss", $customer_name, $customer_email, $username);
                //$stmt->bind_param("ssss", $customer_name, $customer_email, $customer_phone, $username);
                $stmt->execute();
                $stmt->bind_result($user_exist);
                $stmt->fetch();
                $stmt->close();
                if($user_exist){
                // show the form
                $error = 'ERROR: User already Exists!';
                renderForm( $customer_name, $customer_email, $username, $error);
                }
        else {
                    // insert the new record into the database
                    if ($stmt = $mysqli->prepare("INSERT users (customer_name, customer_email, customer_phone, user_name) VALUES (?, ?, ?, ?)"))
                    {
                        $stmt->bind_param("ssss", $customer_name, $customer_email, $customer_phone, $username);
                        $stmt->execute();
                        $stmt->close();
                    }
                    // show an error if the query has an error
                else
                    {
                        echo "ERROR: Could not prepare SQL statement.";
                    }
                    // redirect the user
            header("Location: view-all-customers.php");
        }
    }
}
    // if the form hasn't been submitted yet, show the form
    else
    {
        renderForm();
    }
// close the mysqli connection
$mysqli->close();
?>
I don't get where it's going wrong, think it's only happened since the hosting has upgraded to php version 7