title: Cookies and Functions
body: <p>I need to create a cookie after all of my form data is filled in by the user. But it also needs to take the user to a Acknowledgement page after the submit button is hit. The code I have is this.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  
           function validation() 
           {
              var name = document.getElementById ('name').value;
              var address = document.getElementById ('address').value;
              var phone = document.getElementById ('phone').value;
              var email = document.getElementById ('email').value;
              var age = document.getElementById ('age').value;
              var gender = document.getElementById ('gender').value;
              var height = document.getElementById ('height').value;
              var weight = document.getElementById ('weight').value;
              var waist = document.getElementById ('waist').value;
              var medications = document.getElementById ('medications').value;
  
              if (name=="" || address=="" || phone=="" || email=="" || age=="" || gender==""
                  || gender=="" || height=="" || weight=="" || waist=="" || medications=="")
                  {
                      alert("Please fill in all Fields.");
                      return false;
                  }   
              else
              {
                  return true; 
              }
           }
  
          function WriteCookie() 
          {
              if( document.Myform.name.value == "")
              {
                  return false;
              }
              else
              {
                  cookievalue= escape(document.Myform.name.value) + ";" ;
                  document.cookie = "name=" + cookievalue;
                  alert("Setting Cookies: " + "name=" + cookievalue);
                  return true;
              }   
          }       
  
          function start()
          {
              validation();
              WriteCookie();
          }   
  
          start();
      &lt;/script&gt;
  
      &lt;/head&gt;
  &lt;body&gt;
  </code></pre>
  
  <p>It takes the user to the acknowledgement page but it is not creating my cookie and I am unsure how to fix this. Can someone please help?</p>