0% found this document useful (0 votes)
24 views3 pages

8 (A)

nice

Uploaded by

Chaithra Jayram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views3 pages

8 (A)

nice

Uploaded by

Chaithra Jayram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CHAITHRA MJ 1CD17CS039

7th A

PROGRAM 8(a)

<html>

<head>

<style>

table, td, th

border: 1px solid black;

width: 35%;

text-align: center;

background-color: DarkGray;

table { margin: auto; }

input,p { text-align:right; }

</style>

</head>

<body>

<form method="post">

<table>

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

<tr><td>First Number:</td><td><input type="text" name="num1"

/></td>

1
<td rowspan="2"><input type="submit"

name="submit"

value="calculate"></td></tr>

<tr><td>Second Number:</td><td><input

type="text"

name="num2"/></td></tr>

</form>

<?php

if(isset($_POST['submit'])) // it checks if the input submit is filled

$num1 = $_POST['num1'];

$num2 = $_POST['num2'];

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

echo "<tr><td> Addition :</td><td><p>".($num1+$num2)."</p></td>";

echo "<tr><td> Subtraction :</td><td><p> ".($num1-$num2)."</p></td>";

echo "<tr><td> Multiplication

:</td><td><p>".($num1*$num2)."</p></td>";

echo "<tr><td>Division :</td><td><p> ".($num1/$num2)."</p></td>";

echo "</table>";

else

echo"<script type='text/javascript' > alert(' ENTER

2
VALID NUMBER');</script>";

?>

</body>

</html>

OUTPUT:

You might also like