Thursday, September 5, 2013

Check Vowel or Constant

Vowel or Constant

check the weather the entered Character is Vowel or Constant

Create a  VowelConstant.php  file and add following code to it 



<!Doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title> Vowel or Constant</title>
</head>
<body  bgcolor="lightgray">
<?php error_reporting(E_ALL^E_NOTICE)?>
<div align='Center'>
<h1>Check It is Vowel or Constant</h1>
<form name="form1" action="VowelConstant.php" method="POST" >
<table >
<tr><td>Enter First Value</td><td><input type="text" name="value1" maxlength="1" /></td></tr>
<tr><td colspan="2" align="Center"><input type="Submit" name="submit1" value="Calculate" /></td></tr>
<tr><font color="red"><td>Result</td><td><?php 
//echo $Value1." Total " .$Value2;
if(isset($_POST['submit1'])){ // this will not run for 1st time
$Value1=$_POST['value1']; // taking the value from textbox 
if($Value1 =="a" || $Value1 =="e" || $Value1 =="i" ||$Value1 =="o" || $Value1 =="u" || $Value1 =="A" || $Value1 =="E" || $Value1 =="I" ||$Value1 =="O" || $Value1 =="U"  ){//checking in both lower and upper case
echo "$Value1 is a Vowel!!";
}else{
echo "$Value1 is a Constant!!";
}
}
?></td></font></tr>
</table
</form>
</div> 
</body>
</html>

No comments:

Post a Comment