title: my html form wont validate.see html code and java script in the snippets
body: <p>My html form wont validate but i tried to submit it to the js code using the PatientRegistration value as the name the html form will call from the form action="addpatient.php" method="post" name="PatientRegistration" onsubmit="return(validate());" and script type="text/javascript" src="validate.js" for more details see the code snippets below
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function validate()
  { 
     if( document.PatientRegistration.id.value == "" )
     {
       alert( "Please provide your ID!" );
       document.PatientRegistration.id.focus() ;
       return false;
     }
     if( document.PatientRegistration.name.value == "" )
     {
       alert( "Please provide your  Name!" );
       document.PatientRegistration.name.focus() ;
       return false;
     }
     
     if( document.PatientRegistration.address.value == "" )
     {
       alert( "Please provide your Postal Address!" );
       document.PatientRegistration.address.focus() ;
       return false;
     }
     
     if ( ( PatientRegistration.sex[0].checked == false ) &amp;&amp; ( PatientRegistration.sex[1].checked == false ) )
     {
     alert ( "Please choose your Gender: Male or Female" );
     return false;
     }   
     if( document.PatientRegistration.occupation.value == "" )
     {
       alert( "Please provide your  Occupation!" );
       document.PatientRegistration.occupation.focus() ;
       return false;
     }
      
   
   if( document.PatientRegistration.age.value == "" )
     {
       alert( "Please provide your age!" );
       document.PatientRegistration.age.focus() ;
       return false;
     }
   
  end of java script</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;head&gt;
   &lt;title&gt;Patient Registration Form&lt;/title&gt;
   &lt;script type="text/javascript" src="validate.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form action="addpatient.php" method="post" name="PatientRegistration" onsubmit="return(validate());"&gt;
  
   &lt;table cellpadding="2" width="20%" bgcolor="99FFFF" align="center"
   cellspacing="2"&gt;
   
    &lt;tr&gt;
     &lt;td colspan=2&gt;
     &lt;center&gt;&lt;font size=4&gt;&lt;b&gt;Patient Registration Form&lt;/b&gt;&lt;/font&gt;&lt;/center&gt;
     &lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
     &lt;td&gt;ID&lt;/td&gt;
     &lt;td&gt;&lt;input type="text" name="id" id="id" size="30"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
     &lt;td&gt;Name&lt;/td&gt;
     &lt;td&gt;&lt;input type="text" name="name" id="name"
     size="30"&gt;&lt;/td&gt;
    &lt;/tr&gt;
   
    &lt;tr&gt;
     &lt;td&gt;Postal Address&lt;/td&gt;
     &lt;td&gt;&lt;input type="text" name="address" id="address" size="30"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    
  
    &lt;tr&gt;
     &lt;td&gt;Sex&lt;/td&gt;
     &lt;td&gt;
      &lt;input type="radio" name="gender" value="male" size="10"&gt;Male
      &lt;input type="radio" name="gender" value="Female" size="10"&gt;Female
     &lt;/td&gt;
    &lt;/tr&gt;
  &lt;tr&gt;
     &lt;td&gt;Occupation&lt;/td&gt;
     &lt;td&gt;&lt;input type="text" name="occupation" id="occupation" size="30"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
     &lt;td&gt;Age&lt;/td&gt;
     &lt;td&gt;&lt;input type="text" name="age" id="age" size="30"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
     &lt;td&gt;Mobile&lt;/td&gt;
     &lt;td&gt;&lt;input type="text" name="mobile" id="mobile" size="30"&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
     &lt;td&gt;
      &lt;input type="reset"&gt;
     &lt;/td&gt;
     &lt;td colspan="2"&gt;
      &lt;input type="submit" value="Register" /&gt;
     &lt;/td&gt;
    &lt;/tr&gt;
    
   &lt;/table&gt;
   
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>