Skip to content

Instantly share code, notes, and snippets.

@localdevm
Created May 12, 2016 14:15
Show Gist options
  • Save localdevm/14efa3c7eb94d0162f72c04f99a4125a to your computer and use it in GitHub Desktop.
Save localdevm/14efa3c7eb94d0162f72c04f99a4125a to your computer and use it in GitHub Desktop.
<html>
<head>
<title>HTML Calculator</title>
</head>
<body>
<?php
$total = "";
if (isset($_GET["txtOutput"])){
$total = $_GET["txtOutput"];
}
if (isset($_GET["btn1"])){
$total = 1;
}
if (isset($_GET["btn2"])){
$total = 2;
}
if (isset($_GET["btn3"])){
$total = 3;
}
if (isset($_GET["btn4"])){
$total = 4;
}
if (isset($_GET["btn5"])){
$total = 5;
}
if (isset($_GET["btn6"])){
$total = 6;
}
if (isset($_GET["btn7"])){
$total = 7;
}
if (isset($_GET["btn8"])){
$total = 8;
}
if (isset($_GET["btn9"])){
$total = 9;
}
if (isset($_GET["btn0"])){
$total = 0;
}
?>
<form name="calculator" method="get" action="">
<input type="submit" name="btn1" value="1">
<input type="submit" name="btn2" value="2">
<input type="submit" name="btn3" value="3">
<input type="button" name="btnAdd" value="+">
<br>
<input type="submit" name="btn4" value="4">
<input type="submit" name="btn5" value="5">
<input type="submit" name="btn6" value="6">
<input type="submit" name="btnSub" value="-">
<br>
<input type="submit" name="btn7" value="7">
<input type="submit" name="btn8" value="8">
<input type="submit" name="btn9" value="9">
<input type="submit" name="btnMult" value="*">
<input type="submit" name="btnDiv" value="/">
<br>
<input type="button" name="btn1" value="0">
<input type="reset" name="btnreset" value="Reset">
<input type="button" name="btngelijk" value="=">
<br>
<input type="text" name="txtOutput" value="<?php echo $total; ?>">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment