Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use PHP Create Multiplication/Division/Adding/Subtracting calculator Number 1 Nu

ID: 3735975 • Letter: U

Question

Use PHP

Create Multiplication/Division/Adding/Subtracting calculator Number 1 Number 2 Action: o Multiplication o Division o Adding o Subtracting Calculate Add Calculator to PHP page as a form not as a link. Display result on the same page. Make "Adding": sticky This is Final Homework and graded with 400 points 100-for creating form on PHP site, so its looks close to mine and looks like a form 100- for Correct result displayed on the same page 100-for stickiness. After displaying result, form should appear again with stickiness on Adding 100-for Any type of validation. Display validation on the same page with form to fill again

Explanation / Answer

<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="css/bootstrap.css"/>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>

<script type="text/javascript" src="js/bootstrapValidator.js"></script>

</head>
<body>

<?php

if(isset($_POST['add']))
{
$n1=$_POST['name1'];
$n2=$_POST['name2'];

$res1=$n1+$n2;

}


if(isset($_POST['sub']))
{
echo $n1=$_POST['name1'];
echo $n2=$_POST['name2'];

$res2=$n1-$n2;

}


if(isset($_POST['mul']))
{
echo $n1=$_POST['name1'];
echo $n2=$_POST['name2'];

$res3=$n1*$n2;

}


if(isset($_POST['div']))
{
echo $n1=$_POST['name1'];
echo $n2=$_POST['name2'];

$res4=$n1/$n2;

}
?>

<div class="jumbotron">
<h2>Simple Calculator</h2>
<div class="container">

<?php if(isset($res1)){ ?><div class="alert alert-success" role="alert"> <?php echo $res1; ?> </div><?php } ?>

<?php if(isset($res2)){ ?><div class="alert alert-success" role="alert"> <?php echo $res2; ?> </div><?php } ?>
<?php if(isset($res3)){ ?><div class="alert alert-success" role="alert"> <?php echo $res3; ?> </div><?php } ?>
<?php if(isset($res4)){ ?><div class="alert alert-success" role="alert"> <?php echo $res4; ?> </div><?php } ?>

<form method="post" action="">
<label>Enter Number 1</label>
<input type="text" class="form-control" name="name1">
<br>
<label>Enter Number 2</label>
<input type="text" class="form-control" name="name2">
<br>
<button type="submit" name="add" class="btn btn-info">Addition</button>
<br>
<button type="submit" name="sub" class="btn btn-info">Substraction</button>
<br>
<button type="submit" name="mul" class="btn btn-info">Multiplication</button>
<br>
<button type="submit" name="div" class="btn btn-info">Division</button>

</form>

</div>

</div>

</body>
</html>

I have done this please check.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote