title: How to create multiple login and registration form using JavaScript only and storing to the local server
body: <p>I need some help I have created a login and registration form and its stores its values to the local storage. This is for a class, how can I make it to accept more than one user. Right now it only takes one username and password.</p>
  
  <p>Thanks in advance,</p>
  
  <pre><code>&lt;!-- sign up form  --&gt;
      &lt;div class="container pt-5"&gt;
  
          &lt;!-- registration form  --&gt;
          &lt;form id="register-form"&gt;
              &lt;input id="uName" type="text" placeholder="Name" value="" /&gt;
              &lt;input id="uPw" type="password" placeholder="Password" value="" /&gt;
              &lt;input id="rgstr_btn" type="submit" value="get Account" onClick="store()" /&gt;
          &lt;/form&gt;
  
          &lt;!-- login form --&gt;
  
          &lt;form id="login-form" action="./index.html"&gt;
              &lt;input id="userName" type="text" placeholder="Enter Username" value="" /&gt;
              &lt;input id="userPw" type="password" placeholder="Enter Password" value="" /&gt;
              &lt;input id="login_btn" type="submit" value="Login" onClick="check()" /&gt;
          &lt;/form&gt;
  
      &lt;/div&gt;
  
  
  // Name and Password from the register-form
  
  var name = [document.getElementById('uName')];
  var pw = document.getElementById('uPw');
  
  // storing input from register-form
  
  function store() {
      localStorage.setItem('name', uName.value);
      localStorage.setItem('pw', uPw.value);
  }
  
  // check if stored data from register-form is equal to entered data in the login-form
  
  function check() {
  
      // stored data from the register-form
  
      var storedName = localStorage.getItem('name');
      var storedPw = localStorage.getItem('pw');
  
      // entered data from the login-form
  
      var usrName = document.getElementById('userName').value;
      var usrPw = document.getElementById('userPw').value;
  
      // check if stored data from register-form is equal to data from login form
  
      if (userName.value == storedName &amp;&amp; userPw.value == storedPw) {
          alert('You are logged in ' + usrName);
          location.replace("./index.html")
  
      } else {
          alert('Access denied. Valid username and password is required.');
      }
  
  }
  </code></pre>