Untitled

 avatar
unknown
plain_text
a month ago
1.8 kB
3
Indexable
<html>

<head>

<title>SIMPLE CALCULATOR</title>

</head>

<body>

<form method="post">

<table>

<caption><h2> SIMPLE CALCULATOR </h2></caption>

<tr>

<td>First Number:</td>

<td><input type="text" name="numl" /></td>

</tr>

<tr>

<td>Second Number:</td><td><input type="text" name="num2"/></td>

</tr>

<tr>

<th colspan="2"><input type="submit" name="submit" value="calculate"></th>

</tr>

</table>

</form>

<?php

if(isset($_POST['submit']

{

    $num1 = $_POST['num1'];

    $num2 = $_POST['num2'];

    if(is_numeric($num1) and is_numeric($num2))

    {

        echo "Addition:".($num1+$num2)."<br>";

        echo "Subtraction:".($num1-$num2)."<br>";

        echo "Multiplication:".($num1*$num2)."<br>";

        echo "Division: ".($num1/$num2);

    }

    else

    {

        echo"<script type='text/javascript'> alert(' ENTER VALID NUMBER');</script>";

        ?>

        </body>

        </html><html>

<head>

<title>SIMPLE CALCULATOR</title>

</head>

<body>

<form method="post">

<table>

<caption><h2> SIMPLE CALCULATOR </h2></caption>

<tr>

<td>First Number:</td>

<td><input type="text" name="numl" /></td>

</tr>

<tr>

<td>Second Number:</td><td><input type="text" name="num2"/></td>

</tr>

<tr>

<th colspan="2"><input type="submit" name="submit" value="calculate"></th>

</tr>

</table>

</form>

<?php

if(isset($_POST['submit']

{

$num1 = $_POST['num1'];

$num2 = $_POST['num2'];

if(is_numeric($num1) and is_numeric($num2))

{

echo "Addition:".($num1+$num2)."<br>";

echo "Subtraction:".($num1-$num2)."<br>";

echo "Multiplication:".($num1*$num2)."<br>";

echo "Division: ".($num1/$num2);

}

else

{

echo"<script type='text/javascript'> alert(' ENTER VALID NUMBER');</script>";

?>

</body>

</html>
    }
    }
}))
Editor is loading...
Leave a Comment