Home Ask Login Register

Developers Planet

Your answer is one click away!

Gaurav Verlekar February 2016

Unable to display sum of data in PHP

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"


<!DOCTYPE html>
    <title>PHP - Add two numbers</title>
        <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"/>


echo "Test";

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

    echo "Total :" . $sum;


Gaurav Verlekar February 2016

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


Hope this helps..

Post Status

Asked in February 2016
Viewed 2,324 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life