send email after validation
<p>hi i am new enough to JavaScript and am wonder how to send details in email after validation ,heres my code </p>

<pre><code>&lt;script type="text/javascript"&gt; 

 var compName=false;
 var compContry=false;
 var compsub=false;
 var compphone=false;
 var compemail=false;


function validate_form(form)
{
    if(compName)
    {
        document.getElementById('country').focus();
        compName=true;
        if(compContry)
        {
            document.getElementById('subject').focus();
            compContry=true;
            if(compsub)
            {
                document.getElementById('Phone').focus();
                compsub=true;
                if(compphone)
                {
                    document.getElementById('email').focus();
                    compphone=true;
                    if(compemail)
                    {

                        //I just use alert to show it works. 
                        alert("Your Details Are Sent ");
                        compemail=true;
                    }
                    else
                    {
                        document.getElementById('email').focus();
                        compemail=false;
                    }
                }
                else
                {
                    document.getElementById('Phone').focus();
                    compphone=false;
                }
            }
            else
            {
                document.getElementById('subject').focus();
                compsub=false;
            }
        }
        else
        {
            document.getElementById('country').focus();
            compContry=false;
        }
    }
    else
    {
        document.getElementById('username').focus();
        compName=false;
    }

}
</code></pre>
