PHP insert query not working and not giving any errors
<p>Hey there sorry if this question may have been asked too much but none of the questions I saw on the website helps me, And as the title pointed out I have an insert query that would create an account for a website I am making but when I press the submit button It would do nothing ... Just refresh the page.</p>

<p>NOTE: database included.
This part of the website is included inside signup.php and in signup.php the connect file is included.
And after testing I could fetch from connect.php so I do not think that that is the problem.
Even though That does not justify why the code would not always run.</p>

<p>After troubleshooting and testing I figured out that by removing this part of the code :</p>

<pre><code>        if (
        $username_error_message_status = false
        and $password_error_message_status = false
        and $email_error_message_status = false
        and $bot_check_error_message_status = false
    ) {
</code></pre>

<p>The code works yet the insert query statement do not. So any kind of help would be appreciated and thanks for reading.</p>

<p>Full code :</p>

<pre><code>    &lt;?php
    $sign_up_button = isset($_POST["sign_up_button"]);

    $username_error_message = $password_error_message = $email_error_message = $bot_check_error_message = "";
    $username_error_message_status = $password_error_message_status = $email_error_message_status = $bot_check_error_message_status = "";
    $username_field = $email_field = "";

    if ($sign_up_button) {

        $username_field = $_POST["sign_up_username"];
        $password_field = $_POST["sign_up_password"];
        $email_field = $_POST["sign_up_email"];
        $bot_check_field = isset($_POST["sign_up_bot_check"]);

        if ($_SERVER["REQUEST_METHOD"] == "POST") {

            if (empty($username_field)) {
                $username_error_message_status = true;
                $username_error_message = "This field is required.";
            } 
            else {
                $username_error_message_status = false;
            }

            if (empty($password_field)) {
                $password_error_message_status = true;
                $password_error_message = "This field is required.";
            } 
            else {
                $password_error_message_status = false;
            }

            if (empty($email_field)) {
                $email_error_message_status = true;
                $email_error_message    = "This field is required.";
            } 
            else {
                $email_error_message_status = false;
            }       

            if ($bot_check_field &lt; 100) {
                $bot_check_error_message_status = true;
                $bot_check_error_message    = "Please slide the slider to the end.";
            } 
            else {
                $bot_check_error_message_status = false;
            }           

        }
        if (
            $username_error_message_status = false
            and $password_error_message_status = false
            and $email_error_message_status = false
            and $bot_check_error_message_status = false
        ) {
            /* --- --- --- --- --- --- --- --- Check username availability --- --- --- --- --- --- --- --- */

            $check_username_query = "SELECT `Username` FROM `users` WHERE `Username` = '$username_field' ";

            $check_username_query_result = mysqli_query($GLOBALS["___mysqli_ston"], $check_username_query);
            $numrows_check_username_query_result = mysqli_num_rows($check_username_query_result);
            if ($numrows_check_username_query_result == 1) {
                $username_availability_status = false;
            ?&gt;
                &lt;p&gt;&lt;span class = "sign-up-error-tag"&gt;That username already exists in our database. Please choose another.&lt;/span&gt;&lt;/p&gt;
            &lt;?php
            }
            else {
                $username_availability_status = true;
            }

            /* --- --- --- --- --- --- --- --- Check email availability --- --- --- --- --- --- --- --- */

            $check_email_query = "SELECT `Email` FROM `users` WHERE `Email` = '$email_field' ";

            $check_email_query_result = mysqli_query($GLOBALS["___mysqli_ston"], $check_email_query);
            $numrows_check_email_query_result = mysqli_num_rows($check_email_query_result);
            if ($numrows_check_email_query_result == 1) {
                $email_availability_status = false;
            ?&gt;
                &lt;p&gt;&lt;span class = "sign-up-error-tag"&gt;That email already exists in our database. Please choose another.&lt;/span&gt;&lt;/p&gt;
            &lt;?php
            }
            else {
                $email_availability_status = true;
            }

            /* --- --- --- --- --- --- --- --- Check email validity --- --- --- --- --- --- --- --- */

            if (filter_var($email_field, FILTER_VALIDATE_EMAIL)) {
                $email_validity_status = true;
            }
            else {
                $email_validity_status = false;
            ?&gt;
                &lt;span class = "sign-up-error-tag"&gt;That email is invalid. Please choose another.&lt;/span&gt;
            &lt;?php
            }

            /* --- --- --- --- --- --- --- --- Hashing password --- --- --- --- --- --- --- --- */

            function better_crypt($input, $rounds = 7) {
            $salt = "";
            $salt_chars = array_merge(range('A','Z'), range('a','z'), range(0,9));
            for($i=0; $i &lt; 22; $i++) {
            $salt .= $salt_chars[array_rand($salt_chars)];
            }
            return crypt($input, sprintf('$2a$%02d$', $rounds) . $salt);
            }
            $password_field_hash = better_crypt($password_field);
            $password_field_hash = better_crypt($password_field, 10);
            $password_field_hash = better_crypt($password_field, 15);       

            /* --- --- --- --- --- --- --- --- Create account in database --- --- --- --- --- --- --- --- */

            $sign_up_date = date("Y-m-d h:i:sa");
            $sign_up_code = rand();
            $sign_up_active_status = "0";

            $create_account_query = mysqli_query($GLOBALS["___mysqli_ston"], "INSERT INTO `users`(`Username`, `Email`, `Password`, `RegisterCode`, `Date`, `ActiveStatus`) VALUES ('$username_field', '$email_field', '$password_field_hash', '$sign_up_code', '$sign_up_date', '$sign_up_active_status')"); 

            /* --- --- --- --- --- --- --- --- Send activation email --- --- --- --- --- --- --- --- */

            $email_to = $email_field;
            $WebsiteName = "ForTheHodor";
            $email_message = "
            &lt;table width='100%' border='0' cellspacing='0' cellpadding='3'&gt;
               &lt;tr&gt;
                &lt;td colspan=2&gt;&lt;b&gt;".$WebsiteName."&lt;/b&gt;&lt;/td&gt;
              &lt;/tr&gt;
               &lt;tr&gt;
                &lt;td colspan=2&gt;Thank you for creating an account.&lt;/td&gt;
              &lt;/tr&gt;
                &lt;/table&gt;
                &lt;hr&gt;&lt;h3&gt;Account info&lt;/h3&gt;&lt;hr&gt;
                &lt;table width='100%' border='0' cellspacing='0' cellpadding='3'&gt;
              &lt;tr&gt;
                &lt;td width='28%' &gt;Username : &lt;/td&gt;
                &lt;td width='72%'&gt;".$username_field."&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                &lt;td&gt;Email : &lt;/td&gt;
                &lt;td&gt;".$email_field."&lt;/td&gt;
              &lt;/tr&gt;
            &lt;/table&gt;
            &lt;p&gt;".$WebsiteName." advise you not to delete this email for it contains informations that could be in use later.&lt;/p&gt;
                &lt;hr&gt;&lt;h3&gt;Account activation&lt;/h3&gt;&lt;hr&gt;
                &lt;p&gt;If you wish to activate your account please use the following link : &lt;/p&gt;
                &lt;p&gt;&lt;a href = 'localhost/SignalShare/activate.php' style = 'text-decoration: none; color: blue;' &gt;Activate account&lt;/a&gt;&lt;/p&gt;
                &lt;p&gt;Activiation code :&lt;/p&gt;
                &lt;p&gt;".$sign_up_code."&lt;/p&gt;
                &lt;hr&gt; 
                &lt;p&gt;If this email does not concern you please ignore it.&lt;/p&gt;
                &lt;p&gt;All regards.&lt;/p&gt;
                &lt;p&gt;".$WebsiteName."&lt;/p&gt;
                ";
            $email_subject = "Accout activation";                               
            $email_headers  = "From:".$WebsiteName."\r\n";
            $email_headers .= "Content-type: text/html\r\n"; 

            mail($email_to, $email_subject, $email_message, $email_headers);    

            echo $email_message;    

        }

    }
?&gt;
&lt;div id = "SignupForm"&gt;
    &lt;div class="panel panel-default"&gt;
        &lt;div class="panel-heading"&gt;
            &lt;h3 class="panel-title"&gt;Sign up&lt;/h3&gt;
        &lt;/div&gt;
        &lt;div class="panel-body"&gt;
            &lt;span&gt;
                &lt;form method = "POST" action= "signup.php"&gt;
                    &lt;table class = "table table-borderless"&gt;
                        &lt;thead&gt;
                            &lt;tr&gt;
                                &lt;th&gt;&lt;/th&gt;
                                &lt;th&gt;&lt;/th&gt;
                            &lt;/tr&gt;
                        &lt;/thead&gt;
                        &lt;tbody&gt;                 
                            &lt;tr&gt;
                                &lt;td&gt;
                                    &lt;span class = "Sign-up-tag"&gt;Username&lt;/span&gt;
                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;input type = "text" name = "sign_up_username" class = "sign-up-field" value = "&lt;?php echo $username_field; ?&gt;"&gt;&lt;/input&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;
                                &lt;td&gt;

                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;span class = "sign-up-error-tag"&gt;&lt;b&gt;&lt;?php echo $username_error_message; ?&gt;&lt;/b&gt;&lt;/span&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;
                                &lt;td&gt;
                                    &lt;span class = "Sign-up-tag"&gt;Password&lt;/span&gt;
                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;input type = "password" name = "sign_up_password" class = "sign-up-field"&gt;&lt;/input&gt; 
                                &lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;
                                &lt;td&gt;

                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;span class = "sign-up-error-tag"&gt;&lt;b&gt;&lt;?php echo $password_error_message; ?&gt;&lt;/b&gt;&lt;/span&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;
                                &lt;td&gt;
                                    &lt;span class= "Sign-up-tag"&gt;Email&lt;/span&gt;
                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;input type = "text" name = "sign_up_email" class = "sign-up-field" value = "&lt;?php echo $email_field; ?&gt;"&gt;&lt;/input&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;
                                &lt;td&gt;

                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;span class = "sign-up-error-tag"&gt;&lt;b&gt;&lt;?php echo $email_error_message; ?&gt;&lt;/b&gt;&lt;/span&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;
                                &lt;td&gt;
                                    &lt;span class= "Sign-up-tag"&gt;Bot check&lt;/span&gt;
                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;input id= "defaultSlider" type="range" min="0" max="100" value = "0" name = "sign_up_bot_check"/&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;
                                &lt;td&gt;

                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;span class = "sign-up-error-tag"&gt;&lt;b&gt;&lt;?php echo $bot_check_error_message; ?&gt;&lt;/b&gt;&lt;/span&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt;
                            &lt;tr&gt;
                                &lt;td&gt;

                                &lt;/td&gt;
                                &lt;td&gt;
                                    &lt;input type = "submit" name = "sign_up_button" class="btn btn-success" value = "Sign up"&gt;&lt;/input&gt;
                                &lt;/td&gt;
                            &lt;/tr&gt;
                        &lt;/tbody&gt;
                    &lt;/table&gt;
                &lt;/form&gt;             
            &lt;/span&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Table shema :</p>

<pre><code>    -- phpMyAdmin SQL Dump
-- version 4.5.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 12, 2016 at 07:59 AM
-- Server version: 5.7.11
-- PHP Version: 5.6.19

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `forthehodor`
--

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `ID` int(11) NOT NULL,
  `Username` varchar(32) NOT NULL,
  `Email` varchar(45) NOT NULL,
  `Password` varchar(32) NOT NULL,
  `RegisterCode` varchar(50) NOT NULL,
  `Date` varchar(50) NOT NULL,
  `ActiveStatus` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`ID`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
</code></pre>