0

I am using the following environment:

PHP version 5.6 Apache 2.4 O.S Windows 10.

Following is the code for my form and the PHP script that handles the form submission. When I submit the form I get a blank page. It doesn't print "Total:". Also, if I remove the isset condition, I get the following error:

"Notice: Undefined index: value1 in F:\small php projects\addnnum.php on line 5"

"Notice: Undefined index: value2 in F:\small php projects\addnnum.php on line 6"

addnum.html

<!DOCTYPE html>
<html>
    <title>PHP - Add two numbers</title>
    <body>
        <form action="addnnum.php" method="post">
            <input type="number" name="value1" value="0" />
            <input type="number" name="value2" value="0" />
            <input type="submit" name="submit" value="Calculate values"/>
        </form>
    </body>
</html>

addnnum.php

<?php
echo "Test";

if (isset($_POST['submit']))
{
    $value1 = $_POST['value1'];
    $value2 = $_POST['value2'];
    $sum    = $value1 + $value2;

    echo "Total :" . $sum;
}
?>
Don't Panic
  • 41,125
  • 10
  • 61
  • 80

1 Answers1

0

I found the reason for the issue. It seems to be issue in PHP storm version 10.

I have uninstalled ver 10 and installed ver 9. It works perfectly ok. Here's the link

https://intellij-support.jetbrains.com/hc/en-us/community/posts/206999125-PhPStorm-10-does-not-allow-POST-method

Hope this helps..