This Program Is About How To Find Odd And Even Number In Php Using Given Number Into The Html Text Box.
PHP FILE CODE
<?php
$n=$_POST['n'];
if(isset($_POST['submit']))
{
for($i=0;$i<=$n;$i++)
{
if($i%2==0)
{
$s+=$i;
echo $s;
}
else
{
$o+=$i;
echo $o;
}
}
}
else
{
}
?>
HTML FILE CODE
<html>
<head>
<title>odd even number</title>
</head>
<body>
<form method="post">
range start 0;
<input type="text" name="n">
<input type="submit" name="submit" value="submit">
</form>
<input type="text" value="<?php echo $s; ?>">
<input type="text" value="<?php echo $o; ?>" >
</body>
</html>
No comments:
Post a Comment