PHP. Использование JavaScript для проверки данных.

<html> <head>

 <SCRIPT LANGUAGE="JavaScript">
 <!--
 function checker ()
 {
	 var regExp1=/^(\d{1,2})-(\d{1,2})-(\d{2})$/
	 var regExp2 = /^(\d{1,2})-(\d{1,2})-(\d{4})$/
	 var result1=document.form1.date1/value.match (regExp1)
	 var result2=document.form1.date1/value.match (regExp2)
	 if (result1 == null && result2 == null) { 
	 alert ("Data vvedena neverno . Korrectnii format - DD-MM-GG ili DD-MM-GGGG")
	 document.form1.date1.value=""
	 return false
	 }
  
 else 
 {
	 document.form1.submit ()
 }
 
 }
 //-->
 </SCRIPT>

 
<title>Proverka Dati</title></head>
<body> 
 
 
 
 
 <FORM NAME="form1" ACTION="somepage.php" METHOD="POST" ONSUBMIT="return checker()">
 Vvedite datu:
 <INPUT TYPE="TEXT" NAME="date1">
 <INPUT TYPE="SUBMIT" VALUE="OK">
 <FORM>
 
 
 
 
 
 
  </body>
  </html>