I want to access HTML data in the PHP file to add two numbers. Below is the HTML code to take user input-
addnumber.html
<html>
<head>
</head>
<body>
<form action="add.php" method="POST">
<input type="number" name="fno"/>
<input type="number" name="sno"/>
<input type="submit"/>
</form>
</body>
</html>
Below id the add.php file code
<?php
$a = $POST['fno'];
$b = $POST['sno'];
$ans = $a+$b;
echo $ans;
?>
But after clicking the submit button in the chrome PHP code is shown instead of the result of two number addition.
Is the file code not running because I need to use localhost:8080 instead of localhost. Please help if possible.
Note: I can run PHP using http://localhost:8080/programs/add.php line.