1 Απάντηση
2
05/11/2024 8:29 πμ
- The form will be with 2 input elements, with names num1 and num2
- You must check both elements, if they have values before we perform any action
- When we have checked both elements we get them both and extract their values into variables and we perform the specified action:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<form>
N: <input type="text" name="num1"/>
M: <input type="text" name="num2"/>
<input type="submit"/>
</form>
<?php
if (isset($_GET['num1']) && isset($_GET['num2'])) {
$num1 = intval($_GET['num1']);
$num2 = intval($_GET['num2']);
echo $num1 * $num2;
}
?>
</body>
</html>

