PHP_Lab_Tasks_Solution
PHP_Lab_Tasks_Solution
<!DOCTYPE html>
<html>
<head><title>Multiplication Table</title></head>
<body>
<form method="post">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$num = $_POST['num'];
?>
</body>
</html>
Sample Output:
5x1=5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
5 x 6 = 30
5 x 7 = 35
5 x 8 = 40
5 x 9 = 45
5 x 10 = 50
Task 2: Even or Odd Checker
<!DOCTYPE html>
<html>
<body>
<form method="post">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$num = $_POST['num'];
if ($num % 2 == 0) {
} else {
?>
</body>
</html>
Sample Output:
5 is Odd.
Task 3: Username and Password Validation
<!DOCTYPE html>
<html>
<head><title>Login Validation</title></head>
<body>
<form method="post">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$username = $_POST['username'];
$password = $_POST['password'];
} else {
?>
</body>
</html>
Sample Output: