A simple program that I wrote that will ask the user to give a number and then it will generate the even numbers using PHP programming language.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Listing
index.php
<?php
$res = "";
if (isset($_POST["txtNum"])) {
$num = $_POST["txtNum"];
while ($num >= 0) {
$num--;
if ($num % 2 == 0 && $num != 0) {
$res .= $num.' ';
}
}
$res = "<p>".$res."</p>";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Even Numbers Problem</title>
<style>
form {
width: 250px;
margin: 200px auto 0;
}
fieldset {
padding: 20px 25px 20px 20px;
}
input {
width: 100%;
}
</style>
</head>
<body>
<form action="" method="post">
<fieldset>
<legend>The Even Numbers Problem</legend>
<label for="fname">Enter a number:</label>
<input type="number" id="txtNum" name="txtNum"><br><br>
<button type="submit">Submit</button>
</fieldset>
<?php echo $res; ?>
</form>
</body>
</html>
No comments:
Post a Comment