Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// 获取用户输入的两个数字并转换类型
$num1 = $_POST['number1'];
$num2 = $_POST['number2'];
$num1 = 1;
$num2 = 3;
// 验证输入是否为数字
if (is_numeric($num1) && is_numeric($num2)) {
// 计算两个数字的和
$sum = $num1 + $num2;
echo "The sum of the two numbers is: ". $sum;
} else {
echo "Please enter valid numbers.";
}
}
?>