problem in captcha validation
<?php
session_start();
$_SESSION['n1'] = rand(1,20);
$_SESSION['n2'] = rand(1,20);
$_SESSION['expect'] = $_SESSION['n1']+$_SESSION['n2'];


$str='';
if($_SESSION['errStr'])
{
	$str='<div class="error">'.$_SESSION['errStr'].'</div>';
	unset($_SESSION['errStr']);
}

$success='';
if($_SESSION['sent'])
{
	$success='<h1>Thank you!</h1>';
	
	$css='<style type="text/css">#contact-form{display:none;}</style>';
	
	unset($_SESSION['sent']);
}

?>

<script>

function formValidate()
{
var captcha=document.form.captcha.value;
var num=/^[0-9]+$/;
if(captcha=="")
{
document.getElementById("errCaptcha").innerHTML="Enter Captcha";
}
else if(!captcha.match(num))
{
document.getElementById("errCaptcha").innerHTML="Enter Valid Captcha";
}
else
{
document.getElementById("errCaptcha").innerHTML="";
var ez=1;
}

if(ez==1)
{
return true;
}
else
{
return false;
}
}

</script>
<form id="form3" name="form" action="" onsubmit='return formValidate()' method="post">	
<fieldset class="last">										
				<p>
					<label for="captcha"><?php echo $_SESSION['n1']; ?> + <?php echo $_SESSION['n2'];?> =<span class="style1">*</span><span style="color:red" id="errCaptcha"></span></label></td>
					<input type="text" name="captcha" id="captcha" />				
							
			</fieldset>					
			
			<p class="submit"><button type="submit">Send</button></p>			
						
		</form>		

this is what i am doing, but not able to validate captcha
for eg: 2+2=4
but if i write 2+2=10
it does not validate
problem in captcha validation
===

<?php
session_start();
$_SESSION['n1'] = rand(1,20);
$_SESSION['n2'] = rand(1,20);
$_SESSION['expect'] = $_SESSION['n1']+$_SESSION['n2'];


$str='';
if($_SESSION['errStr'])
{
	$str='<div class="error">'.$_SESSION['errStr'].'</div>';
	unset($_SESSION['errStr']);
}

$success='';
if($_SESSION['sent'])
{
	$success='<h1>Thank you!</h1>';
	
	$css='<style type="text/css">#contact-form{display:none;}</style>';
	
	unset($_SESSION['sent']);
}

?>

<script>

function formValidate()
{
var captcha=document.form.captcha.value;
var num=/^[0-9]+$/;
if(captcha=="")
{
document.getElementById("errCaptcha").innerHTML="Enter Captcha";
}
else if(!captcha.match(num))
{
document.getElementById("errCaptcha").innerHTML="Enter Valid Captcha";
}
else
{
document.getElementById("errCaptcha").innerHTML="";
var ez=1;
}

if(ez==1)
{
return true;
}
else
{
return false;
}
}

</script>
<form id="form3" name="form" action="" onsubmit='return formValidate()' method="post">	
<fieldset class="last">										
				<p>
					<label for="captcha"><?php echo $_SESSION['n1']; ?> + <?php echo $_SESSION['n2'];?> =<span class="style1">*</span><span style="color:red" id="errCaptcha"></span></label></td>
					<input type="text" name="captcha" id="captcha" />				
							
			</fieldset>					
			
			<p class="submit"><button type="submit">Send</button></p>			
						
		</form>		

this is what i am doing, but not able to validate captcha
for eg: 2+2=4
but if i write 2+2=10
it does not validate