title: Webpage to not delete form data after refresh
body: <p>I have a form on a website that requires two text inputs and two radio inputs <em>(one radio input currently not working because I can't figure out how to get them both to print instead of one overwriting the other)</em>. Upon hitting submit, the information posts underneath the form. I am trying to make it so that when the page is refreshed, the previously entered information will not disappear. Is there a simple way to achieve this?</p>
  
  <p>I have heard about setting return onsubmit=false but have had no success so far.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!--COMMENTING FORM--&gt;
                  &lt;div&gt;
                     &lt;div id="getdata"&gt;
                     &lt;form id="form1"  onsubmit="return confirmdata(false)"&gt;
  
                          &lt;!--Input (text) asking for input of name--&gt;
                        &lt;p&gt;&lt;b&gt;Name:&lt;/b&gt;&lt;br&gt;&lt;input type="text" name="nameValue" value="" id="nameValue"&gt;&lt;/p&gt;
  
                        &lt;!--Input (radio) asking for type of output: 
                        &lt;p&gt;&lt;b&gt;Type of Event:&lt;/b&gt;&lt;/p&gt;
                          &lt;input type="radio" name="eventType" value="Food"&gt; Food&lt;/br&gt;
                          &lt;input type="radio" name="eventType" value="Study"&gt; Study&lt;/br&gt;
                          &lt;input type="radio" name="eventType" value="Event"&gt; Event&lt;/br&gt;
                          &lt;input type="radio" name="eventType" value="Danger"&gt; Danger&lt;/br&gt;
  
                          TO DO FIX LATER --&gt;
  
                        &lt;!--Input (radio) asking for location: --&gt;
                        &lt;br&gt;
                        &lt;p&gt;&lt;b&gt;Location:&lt;/b&gt;&lt;/p&gt;
                          &lt;input type="radio" name="locationType" value="Library West"&gt; Library West&lt;/br&gt;
                          &lt;input type="radio" name="locationType" value="Smathers Library"&gt; Smathers Library&lt;/br&gt;
                          &lt;input type="radio" name="locationType" value="Marston Library"&gt; Marston Library&lt;/br&gt;
                          &lt;input type="radio" name="locationType" value="Turlington Plaza"&gt; Turlington Plaza&lt;/br&gt;
  
                        &lt;!--Input (text) asking for input of description--&gt;
                        &lt;br&gt;
                        &lt;p&gt;&lt;b&gt;Description:&lt;/b&gt;&lt;br&gt;&lt;input type="text" style="width:200px; height:50px;" name="desValue" value="" id="desValue"&gt;&lt;/p&gt;
  
                          &lt;!--submit button--&gt;
                          &lt;p&gt;&lt;input type="submit" name="myButton" value="Submit!"&gt;
                          &lt;input type="reset" value="Reset Form"&gt;&lt;/p&gt;
                     &lt;/form&gt;
  
                     &lt;/div&gt;  
  
                     &lt;div id="confirm"&gt;
                     &lt;/div&gt;
  
                  &lt;/div&gt;
                  &lt;/body&gt;
                  &lt;!--COMMENTING FORM END--&gt;
  
                  &lt;!-- COMMENTING FORM SCRIPT --&gt;  
                  &lt;script type="text/javascript"&gt;
                  var txt1 = document.getElementById('nameValue');
                  var types = document.getElementsByName('eventType');
                  var types = document.getElementsByName('locationType');
                  var txt2 = document.getElementById('desValue');
  
                  document.getElementById("form1").addEventListener("submit", confirmdata);
  
                  function confirmdata(event) {
                      event.preventDefault();
                      var nameValue = txt1.value;
                      var selected = 'none';
                      var desValue = txt2.value;
  
                      for (var i = 0; i &lt; types.length; i++) {
                          if (types[i].checked === true) {
                              selected = types[i].value;
                          }
                      }
                          if (selected !== 'none' &amp;&amp; nameValue !== '') {
                              //document.getElementById("confirm").innerHTML += '&lt;p&gt;&lt;b&gt;Name:&lt;/b&gt; ' + nameValue + '&lt;/p&gt;';
                              //document.getElementById("confirm").innerHTML += '&lt;p&gt;&lt;b&gt;Event Type:&lt;/b&gt; ' + selected + '&lt;/p&gt;';
                              //document.getElementById("confirm").innerHTML += '&lt;p&gt;&lt;b&gt;Additional Details: &lt;/b&gt;' + desValue + '&lt;/p&gt;';
                              document.getElementById("confirm").innerHTML += '&lt;p&gt; User &lt;b&gt;' + nameValue + '&lt;/b&gt; has an event located at &lt;b&gt;' + selected + '&lt;/b&gt;. &lt;br&gt;&lt;b&gt; Additional details: &lt;/b&gt;' + desValue + '&lt;/p&gt;';
                              document.getElementById("confirm").innerHTML += '&lt;p&gt;&lt;b&gt;--------------------&lt;/b&gt; ' + '&lt;/p&gt;';
                          } else {
                              alert('Invalid input');
                          }
                          return false;
                  }
                  &lt;/script&gt;
                  &lt;!-- COMMENTING FORM SCRIPT END --&gt; 
  
               
              
                &lt;/form&gt;
              &lt;/div&gt;
            &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>