1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| <?php
if (isset($_GET['btn']))
{
switch ($_GET['btn']) {
case 1:
$myText1 = myAction($_GET['btn']);
break;
case 2:
$myText1 = "dwa";
break;
default:
$myText1 = "inna wartosc";
}
}
else {
$myText1 =0;
}
function myAction($myValue){
return $myValue;
}
?>
<center>
<div style="position: absolute; width: 500px; margin-left: 50%; left: -250px;">
<form action="Kalkulator.php" method="get">
Kalkulator </br> </br></br>
<input type="text" name="Text1" value="<?php echo $myText1; ?>" style=" width: 210px; float: left; margin-left: 140px;" />
</br> </br>
<button type="submit" name="btn" value="C" style="width: 210px;"> C </button>
</br>
<button type="submit" name="btn" value="1" style="width:50px;" > 1 </button>
<button type="submit" name="btn" value="2" style="width:50px;" style="margin-left:10px"; > 2 </button>
<button type="submit" name="btn" value="3" style="width:50px;" style="margin-left:10px"; > 3 </button>
<button type="submit" name="btn" value="dodawanie" style="width:50px;" style="margin-left:10px"; > + </button>
</br>
<button type="submit" name="btn" value="4" style="width:50px;" style="margin:10px 0px 0px 10px;"; > 4 </button>
<button type="submit" name="btn" value="5" style="width:50px;" style="margin-left:10px"; > 5 </button>
<button type="submit" name="btn" value="6" style="width:50px;" style="margin-left:10px"; > 6 </button>
<button type="submit" name="btn" value="odejmowanie" style="width:50px;" style="margin-left:10px"; > - </button>
</br>
<button type="submit" name="btn" value="7" style="width:50px;" style="margin-left:10px"; > 7 </button>
<button type="submit" name="btn" value="8" style="width:50px;" style="margin-left:10px"; > 8 </button>
<button type="submit" name="btn" value="9" style="width:50px;" style="margin-left:10px"; > 9 </button>
<button type="submit" name="btn" value="mnozenie" style="width:50px;" style="margin-left:10px"; > * </button>
</br>
<button type="submit" name="btn" value="przecinek" style="width:50px;" style="margin-left:10px"; > , </button>
<button type="submit" name="btn" value="0" style="width:50px;" style="margin-left:10px"; > 0 </button>
<button type="submit" name="btn" value="rowna" style="width:50px;" style="margin-left:10px"; > = </button>
<button type="submit" name="btn" value="dzielenie" style="width:50px;" style="margin-left:10px"; > / </button>
</form>
</div>
</center> |
Partager