title: storing user input in array
body: <p>I need to do the following (I'm a beginner in programming so please excuse me for my ignorance): I have to ask the user for three different pieces of information on three different text boxes on a form. Then the user has a button called "enter"and when he clicks on it the texts he entered on the three fields should be stored on three different arrays, at this stage I also want to see the user's input to check data is actually being stored in the array. I have beem trying unsuccessfully to get the application to store or show the data on just one of the arrays. I have 2 files: film.html and functions.js. Here's the code. Any help will be greatly appreciated!</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
      &lt;title&gt;Film info&lt;/title&gt;
  
      &lt;script src="jQuery.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="functions.js" type="text/javascript"&gt;&lt;/script&gt;
  
      &lt;/head&gt;
          &lt;body&gt;
  
          &lt;div id="form"&gt;
  
              &lt;h1&gt;&lt;b&gt;Please enter data&lt;/b&gt;&lt;/h1&gt;
          &lt;hr size="3"/&gt;
          &lt;br&gt;
  
              &lt;label for="title"&gt;Title&lt;/label&gt; &lt;input id="title" type="text" &gt; 
          &lt;br&gt;
  
              &lt;label for="name"&gt;Actor&lt;/label&gt;&lt;input id="name" type="text"&gt;
          &lt;br&gt;
  
              &lt;label for="tickets"&gt;tickets&lt;/label&gt;&lt;input id="tickets" type="text"&gt;
          &lt;br&gt;
          &lt;br&gt;
  
              &lt;input type="button" value="Save" onclick="insert(this.form.title.value)"&gt;
              &lt;input type="button" value="Show data" onclick="show()"&gt; &lt;br&gt;
  
              &lt;h2&gt;&lt;b&gt;Data:&lt;/b&gt;&lt;/h2&gt;
          &lt;hr&gt;
          &lt;/div&gt;
  
          &lt;div id= "display"&gt;
  
          &lt;/div&gt;
          &lt;/body&gt;
  
  &lt;/html&gt;
  
  var title=new Array();
  var name=new Array();
  var tickets=new Array();
  
  function insert(val){
    title[title.length]=val;
    }
  
  function show() {
    var string="&lt;b&gt;All Elements of the Array :&lt;/b&gt;&lt;br&gt;";
    for(i = 0; i &lt; title.length; i++) {
    string =string+title[i]+"&lt;br&gt;";
    }
    if(title.length &gt; 0)
   document.getElementById('myDiv').innerHTML = string;
    }
  </code></pre>