Even od Odd
Check the given number is even or odd
Create a EvenOdd.php file and add following code to it
<!Doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Even or Odd </title>
</head>
<body bgcolor="lightgray">
<?php error_reporting(E_ALL^E_NOTICE)?>
<div align='Center'>
<h1>Check It is Even or Odd</h1>
<form name="form1" action="EvenOdd.php" method="POST" >
<table >
<tr><td>Enter First Value</td><td><input type="text" name="value1" /></td></tr>
<tr><td colspan="2" align="Center"><input type="Submit" name="submit1" value="Calculate" /></td></tr>
<tr><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 % 2==0){
echo "$Value1 is a Even Number!!";
}else{
echo "$Value1 is a Odd Number!!";
}
}
?></td></font></tr>
</table
</form>
</div>
</body>
</html>
No comments:
Post a Comment