0

I'm a beginner in PHP so I tried to make a simple calculator where user inputs num1 and num1 and the output would be the both numbers added together...

<!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>PHP</title>
</head>
<body>
    
    <form action="site.php" method="GET">
        <input type="number" name="num1" placeholder="First number">
        <br>
        <input type="number" name="num2" placeholder="Second number">
        <br>
        <input type="submit">
    </form>

    <?php
        echo $_GET["num1"] + $_GET["num2"];
    ?>
</body>
</html>

When I go to the site page it shows me these error warnings before I input anything. I know what's causing the issue but don't know how to fix it.

Before submitting:

Address bar before value input

Output before value input

After submitting with value

Address bar after value input

Output after value input

I just want to get rid of these warnings at the page before submit. Thank you.

Sayan
  • 3
  • 2

0 Answers0