PHP Programs

Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 3: Write a PHP program to check whether a user entered number is even or odd.

even_odd.php

<!DOCTYPE html>
<html>
<head>
	<title>PHP Programs TutorialsDuniya.com</title>
</head>
<body>
	<form action="program1.php" method="GET">
		<input type="number" name="num"><br/>
		<input type="submit">
	</form>	

	<?php
		$num =$_GET["num"];
		if($num%2==0)
		echo "$num is an even numbers";
		else
		echo"$num is a odd numbers";
	?>
</body>
</html>



If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.