title: Form not running PHP
body: <p>So I'm working on an assignment for my class in which I am supposed to take a username and password and check it against a list contained in a table on a database I am connecting too. </p>
  
  <p>Problem is when I am clicking the submit button nothing is happening I think this is likely to be some sort of error in syntax. Since I am new to PHP there is a good possibility it is something obvious, but not so much to me.</p>
  
  <p>I have my database data stored in two PHP arrays (one for each field). I then converted the arrays to json which I will use in my JavaScript function that will be checked against the user inputted data.</p>
  
  <p>I am including a form, a PHP script, and a JavaScript script in one document could this cause the issue?</p>
  
  <p>Here is my code and thank you for any help!</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;?php
  /*config is included in order to protect my login info*/
  require('config.php');
  Echo "Project 4";
  
  /*SQL connection*/
  $conn = new mysqli(DB_HOST,DB_USER,DB_PASS,DB_NAME);
  
  /*Checking Connection*/
  if (mysqli_connect_errno()) {
      printf("Connect failed: %s\n", mysqli_connect_error());
      exit();
  }
  $sql = "SELECT * FROM p4Data";
  $data2 = mysqli_query($conn, $sql);
  
  /*Display Data*/
  echo "&lt;table border = 1 style='float:left'&gt;
  &lt;tr&gt;
      &lt;th&gt;Username&lt;/th&gt;
      &lt;th&gt;Password&lt;/th&gt;
  &lt;/tr&gt;";
  
  //Array Declarations
  $usernameArr = [];
  $passwordArr = []; 
  
  while($records = mysqli_fetch_array($data2)){
    array_push($usernameArr,$records["username"]);
    array_push($passwordArr,$records["password"]);
  }
  echo "&lt;/table&gt;";
  
  //JSON Conversion
  $usernameJson = json_encode($usernameArr);
  $passwordJson = json_encode($passwordArr);
  mysqli_close($conn);
  ?&gt;
  
  
  
  &lt;!-- JAVA SECTION --&gt;
  &lt;script type="text/javascript"&gt;
    var obj = JSON.parse('&lt;?= $usernameJson; ?&gt;');
    var obj2 = JSON.parse('&lt;?= $passwordJson; ?&gt;');
  
    function verifUser(){
      var usernameData = document.getElementById("username").value;
      var passwordData = document.getElementById("password").value;
      for (i = 0; i &lt; 30; i++){
  
        if(usernameData == obj[i]){
          alert("Username verfied at " + i);
          indexLocated = i;
          break;
         }
        }
      }
  &lt;/script&gt;
  
  
  &lt;form name='form-main'&gt;
    Username: &lt;input type="text" id="username"&gt;&lt;br&gt;
    Password: &lt;input type="password" id="password"&gt;&lt;br&gt;
    &lt;input type="button" value="Login &gt;&gt;" id="submitButton" 
  onclick="verifUser()"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>