Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Rumus</title>
- </head>
- <body>
- <form action="" method="POST">
- <input type="text" name="luas" placeholer="Luas">
- <br>
- <input type="text" name="keliling" placeholer="Keliling">
- <br>
- <input type="submit" name="hasil" value="Hasil">
- </form>
- </body>
- </html>
- <?php
- function luas($r,$phi = "3.14"){
- $z= $phi*$r*$r;
- if ($z<=0) {
- $z = "hasil tidak boleh kurang dari 0";
- }
- return $z;
- }
- function keliling($r,$phi = "3.14"){
- $z= 2*$phi*$r;
- if ($z<=0) {
- $z = "hasil tidak boleh kurang dari 0";
- }
- return $z;
- }
- if(isset($_POST['hasil'])
- {
- $luas = $_POST['luas'];
- $keliling = $_POST['keliling'];
- echo "luas = ".luas($luas)."<br>";
- echo "keliling = ".keliling($keliling)."<br>";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement