PHP/JavaScript form validation?
<p>I'm new with PHP and JavaScript. I eant to validate form, and if the form input fields are correct, then send it to php external script. I've tried something like this:</p>

<pre><code>&lt;head&gt;
&lt;script type="text/javascript"&gt;
  function Validate(){
    var x=document.forms["form"]["firstname"].value;
    var y=document.forms["form"]["lastname"].value;
    var z=document.forms["form"]["age"].value;
    if(x==null || x=="") {
      alert("Input name!");
    } else if(y==null || y=="") {
      alert("Input surname!");
    } else if(z==null || z=="") {
      alert("Input age!");
    } else {
  // IS IT POSSIBLE TO SEND FORM HERE FORM VARIABLES TO PHP SCRIPT?
    }
  }
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

  &lt;form name="forma" action="validate.php" method="post" onSubmit="return Validate()"&gt;
    Firstname: &lt;input type="text" name="firstname"&gt;
    Lastname: &lt;input type="text" name="lastname"&gt;
    Age: &lt;input type="text" name="age"&gt;
    &lt;input type="submit"&gt;
  &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
