<?php
if (isset ($_POST ['b1'])){
function add() {
$a = $_POST ['num1'];
$b = $_POST ['num2'];
echo $a + $b ;
}
?>
<h3> <?php add () ?> </h3>
<?php
}
?>
<?php
if (isset ($_POST ['b2'])){
function add() {
$a = $_POST ['num1'];
$b = $_POST ['num2'];
echo $a - $b ;
}
?>
<h3> <?php add () ?> </h3>
<?php
}
?>
<?php
if (isset ($_POST ['b3'])){
function add() {
$a = $_POST ['num1'];
$b = $_POST ['num2'];
echo $a * $b ;
}
?>
<h3> <?php add () ?> </h3>
<?php
}
?>
<?php
if (isset ($_POST ['b4'])){
function add() {
$a = $_POST ['num1'];
$b = $_POST ['num2'];
echo $a / $b ;
}
?>
<h3> <?php add () ?> </h3>
<?php
}
?>
<form method="post">
<label> Enter first number </label>
<input type="number" name="num1"/>
</br>
</br>
<label> Enter second number </label>
<input type="number" name="num2"/>
</br>
</br>
<input type="submit" value="Add" name="b1"/>
<input type="submit" value="Sub" name="b2"/>
<input type="submit" value="Mulip" name="b3"/>
<input type="submit" value="Divid" name="b4"/>
</form>
No comments:
Post a Comment