PHP: Validation with Fadeout JQuery Messages

err3

PHP script with bootstrap Library

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="bootstrap-3.1.1-dist/css/ajax.js"></script>
<link rel="stylesheet" type="text/css" href="bootstrap-3.1.1-dist/css/bootstrap.css"/>
<script type="text/javascript" src="bootstrap-3.1.1-dist/js/bootstrap.js"></script>
</head>
<body>
    	<script type="text/javascript">
        setTimeout(function(){$('#result').fadeOut();}, 5000);
		 setTimeout(function(){$('#error').fadeOut();}, 3000);
        </script>
<?PHP
   $break="<br/>";
  if( $_SERVER['REQUEST_METHOD']=="POST")
  {
	$x=$_POST["txt1"];
	$y=$_POST["txt2"];
	$t=$_POST["txt3"];
	$option=$_POST["type"];

	 if( !empty($x) &&  !empty($y) && !empty($t) )
  	 {	
	 		 if( is_numeric(trim($x))  && is_numeric(trim($y)) &&  is_numeric(trim($t)))
			 {
				 	 if($option=="Simple Interest") 
					 {
					 $si= ($x*$y*$t)/100;
					
					 echo "<div class='alert alert-success' id='result' style='text-align:center;width:40%; margin:5px auto'>";			 echo "$option::".$si;
					 echo "</div>"; 
					 
					 
					 }
					 else if($option=="Compound Interest")
					 {
					$ci= ($x* pow(  1+($y/100),$t ) )-$x;
 					 echo "<div class='alert alert-success' id='result' style='text-align:center;width:40%; margin:5px auto'>";			 echo "$option::".$ci;
					 echo "</div>"; 						  		
					 }
					

			 }
			 else
			 {
			  	 echo "<div class='alert alert-warning' id='error' style='text-align:center;width:40%; margin:5px auto'>";			 echo "Sorry ! Values are not numeric";
					 echo "</div>"; 						  		
				
			 }
	 }
	 else
	 {
			  	 echo "<div class='alert alert-warning' id='error' style='text-align:center;width:40%; margin:5px auto'>";			 echo "Sorry ! values missing";
					 echo "</div>"; 						  		

	 }
  }
   
?>
<div class='alert alert-info'  style='text-align:center;width:60%; margin:5px auto'>
<form action=<?php echo  $_SERVER['PHP_SELF']?>  method="post">
	   
    <select name="type" class="form-control">
    <option selected="selected" value="Simple Interest"> Simple Interest </option>
    <option  value="Compound Interest"> Compound Interest</option>
    </select>	
    
    Capital<input type="text" name="txt1" class="form-control"/>
    Rate<input type="text" name="txt2" class="form-control"/>
    Time<input type="text" name="txt3" class="form-control"/><br/>
    <input  type="submit"  class="btn btn-info" value="Calculate"/>
</form>
</div>	
</body>
</html>

run the PHP script

1. No values given , message comes and fadeout after 3 second

err1

2. Wrong values given , message comes and fadeout after 3 second

err2