title: storing user input in arrays for a log in site?
body: <p>i am trying to make a mock up site that will allow you to create a username and password then for it to send that array of usernames and passwords over to a log in page where you will put in a username or password and it will go threw a process of checking weather it is wright or wrong and then what to do from there. what i have realized is that when i hit the button to send the information over it will not register on the other page. may you please help me find out what i screwed up on.</p>
  
  <p>here is the code for where i create the username and password:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;title&gt;
  create account
  &lt;/title&gt;
  
  
  &lt;script&gt;
  
  function createLogIn() {
  var usernameArray = document.getElementById("usernameMake").value;
  var paswordArray = document.getElementById("pwordMake").value;
  
  unArray.push("usernameArray");
  pwArray.push("paswordArray");
  
  
  localStorage.setItem("unArray", JSON.stringify([]));
  localStorage.setItem("pwArray", JSON.stringify([]));
  
  }
  &lt;/script&gt;
  
  
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;form name = "makeLogIn"&gt;
    &lt;p class="log_on"&gt;
      ENTER YOUR NEW USERNAME &lt;input type="text" id="usernameMake"&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
      ENTER YOUR NEW PASSWORD &lt;input type="text" id="pwordMake"&gt;
      &lt;input type="button" value="create it" id="Submit" onclick="createLogIn"&gt;
    &lt;/p&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  
  
  &lt;/html&gt;
  </code></pre>
  
  <p>here is the code for logging in with that username and password:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;
  log on page
  &lt;/title&gt;
  
  &lt;script type = "text/javascript"&gt;
  var count = 2;
  
  function validate() {
      var un = document.getElementById("username").value;
      var pw = document.getElementById("pword").value;
      var valid = false;
  
      var unArray = JSON.parse(localStorage.getItem("unArray"));
      var pwArray = JSON.parse(localStorage.getItem("pwArray"));
  
      for (var i = 0; i &lt; unArray.length; i++) {
          if ((un == unArray[i]) &amp;&amp; (pw == pwArray[i])) {
          valid = true;
              break;
          }
      }
  
      if (valid) {
          alert ("Login was successful");
          window.location = "http://www.google.com";
          return false;
      }
  
      var t = " tries";
  
      if (count == 1) {t = " try"}
  
      if (count &gt;= 1) {
          alert ("Invalid username and/or password. " +
                 "You have " + count + t + " left.");
          document.myform.username.value = "";
          document.myform.pword.value = "";
          setTimeout("document.myform.username.focus()", 25);
          setTimeout("document.myform.username.select()", 25);
          count --;
      }
  
      else {
          alert ("Still incorrect! You have no more tries left!");
          document.myform.username.value = "No more tries allowed!";
          document.myform.pword.value = "";
          document.myform.username.disabled = true;
          document.myform.pword.disabled = true;
          return false;
      }
  
  }
  &lt;/script&gt;
  
      &lt;style&gt;
  
      p.log_on{
      position: fixed;
      top: 30px;
      left: 20px;
  }
  &lt;/style&gt;
  
  
  
  
  
  &lt;/head&gt;
  
  
  &lt;body&gt;
  
  &lt;form name = "myform"&gt;
    &lt;p class="log_on"&gt;
      ENTER USER NAME &lt;input type="text" id="username"&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
      ENTER PASSWORD &lt;input type="password" id="pword"&gt;
      &lt;input type="button" value="Check In" id="Submit" onclick="validate()"&gt;
    &lt;/p&gt;
  &lt;/form&gt;
  
  &lt;/body&gt;
  
  
  &lt;/html&gt;
  </code></pre>