PHP Program - Substract two Numbers

We can substract two Numbers using PHP Program. We need html elements like form tag, input tag.

$_POST variable is used to retrive 2 numbers.


Example :

$result="Subtraction of " .$num1. " and ".$num2. " : " .$result;

<!DOCTYPE html>
<title>PHP Maths Program - Subtraction two number by aryatechno</title>
<form name="sub" method="post">
<td colspan="2"><strong>Maths Subtraction </strong></td>
<td>Number 1 :</td>
<td><input type="text" name="num1" value="<?=$_POST['num1'] ?>" required></td>
<td>Number 2 :</td>
<td><input type="text" name="num2" value="<?=$_POST['num2'] ?>" required></td>
<td><input type="submit" value="Subtraction " name="submit" /></td>

<td colspan="2"><strong><?=$result ?></strong></td>


Output :


Leave a Reply

Your email address will not be published. Required fields are marked *