Skip to content

Instantly share code, notes, and snippets.

@dikiwidia
Created May 6, 2020 18:14
Show Gist options
  • Save dikiwidia/b0beb1af2c70d9e91d28a192c02a8052 to your computer and use it in GitHub Desktop.
Save dikiwidia/b0beb1af2c70d9e91d28a192c02a8052 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Belajar Fungsi</title>
</head>
<body>
<form action="<?php $_SERVER['PHP_SELF'] ?>" method="post" autocomplete="off">
<p>Panjang</p>
<input type="text" name="p">
<p>Lebar</p>
<input type="text" name="l">
<br><br>
<button type="submit">Hitung</button>
</form>
<br>
<?php
$panjang = $_POST['p'];
$lebar = $_POST['l'];
echo "Hasil: ".hitungLuas($panjang,$lebar);
function hitungLuas($panjang,$lebar){
return $panjang * $lebar;
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment