JS form validation is not working
<p>I have a form where i have  JS form validation. But validation process is not working. The inserting process in working fine. </p>

<p>Below is the form for inserting the data into mysql Database- </p>

<pre><code>&lt;?php
session_start();
include("includes/connection.php");
include("header.php");
include("includes/adminmenu.php");
if(isset($_SESSION['username']))
        {
        //echo $_SESSION['username'];
        ?&gt;
        &lt;!--Javasript Validation File Import --&gt;
&lt;script type="text/javascript" src="js/qcheck.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" language="JavaScript"&gt;

function HidePart(d) { document.getElementById(d).style.display = "none";  }
function ShowPart(d) { document.getElementById(d).style.display = "block"; }
function CheckboxChecked(b,d)
{
   if(b) { ShowPart(d); }
   else  { HidePart(d); }
}
&lt;/script&gt;
    &lt;br /&gt;
    &lt;div class="userstat"&gt;

        &lt;div style="background-color:#666666; text-align:center; font-weight:bold; color:#FFFFFF; font-size:24px;"&gt;&lt;span&gt;Insert A new Question&lt;/span&gt;&lt;/div&gt;
        &lt;br /&gt;
        &lt;div class="statdata"&gt;
            &lt;form action="includes/insertq.php" method="POST" name="qform" onSubmit="return valide()"&gt;
                    &lt;div style="text-align:center;"&gt;
                &lt;select name="subject" size="0"&gt;
                &lt;option selected="0" value=""&gt;Select Subject&lt;/option&gt;
                &lt;option value="bangla"&gt;Bangla&lt;/option&gt;
                &lt;option value="english"&gt;English&lt;/option&gt;
                &lt;option value="physics"&gt;Physics&lt;/option&gt;
                &lt;option value="chemistry"&gt;Chemistry&lt;/option&gt;
                &lt;option value="math"&gt;Mathematics&lt;/option&gt;
                &lt;option value="biology"&gt;Biology&lt;/option&gt;
                &lt;option value="gk"&gt;General knowledge&lt;/option&gt;
                &lt;/select&gt;
                     &lt;/div&gt;
                 &lt;br /&gt;&lt;br /&gt;
                &lt;label for="question"&gt;Write Down the Question below&lt;/label&gt;
                &lt;textarea name="question" rows="3" cols="40"&gt;&lt;/textarea&gt;&lt;br /&gt;&lt;br /&gt;
                &lt;label for="ans"&gt;Options&lt;/label&gt;&lt;br /&gt;&lt;br /&gt;
                &lt;label for="option1"&gt;a.&lt;/label&gt;
                &lt;input type="text" name="option1" size="40" /&gt;&lt;br /&gt;
                &lt;label for="option2"&gt;b.&lt;/label&gt;
                &lt;input type="text" name="option2" size="40" /&gt;&lt;br /&gt;
                &lt;label for="option3"&gt;c.&lt;/label&gt;
                &lt;input type="text" name="option3" size="40" /&gt;&lt;br /&gt;
                &lt;label for="option4"&gt;d.&lt;/label&gt;
                &lt;input type="text" name="option4" size="40" /&gt;&lt;br /&gt;&lt;br /&gt;
                &lt;label for="correct"&gt;Correct.&lt;/label&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;
                &lt;input type="text" name="correct" size="40" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
                &lt;div style="text-align:center;"&gt;
                &lt;input type="submit" name="submit" value="Submit Question" /&gt;
                &lt;/div&gt;
                &lt;br /&gt;
                &lt;br /&gt;
            &lt;/form&gt;
        &lt;/div&gt;
        &lt;/div&gt;

     &lt;/body&gt;
        &lt;?php
        }



    else
        {
        header("location: admin.php");
        }
?&gt;

&lt;?php
include("includes/footer.php");
?&gt;
</code></pre>

<p>and the Javascript file is </p>

<pre><code>function valide()
{
var subject=document.forms["qform"]["subject"].value;
var question=document.forms["qform"]["question"].value;
var option1=document.forms["qform"]["option1"].value;
var option2=document.forms["qform"]["option2"].value;
var option3=document.forms["qform"]["option3"].value;
var option4=document.forms["qform"]["option4"].value;
var correct=document.forms["qform"]["correct"].value;

if(subject == null || Subject == "Select Subject")
    {
        alert("Select subject Type");
        return false;

        }
    else if(question==null || question=="" || question.length&lt;5)
        {
            alert("Insert Valid question");
            return false;
            }   
    else if(option1==null || option1=="")
        {
            alert("Insert Option 1.");
            return false;
            }
    else if(option2==null || option2=="")
        {
            alert("Insert Option 2.");
            return false;
            }
    else if(option3==null || option3=="")
        {
            alert("Insert option 3.");
            return false;
            }   
    else if(option4==null || option4=="")
        {
            alert("Insert option 4.");
            return false;
            }   
    else if(correct==null || correct=="")
        {
            alert("Insert correct option.");
            return false;
            }                                   





}
</code></pre>
