Selasa, 30 April 2013

Laporan Akhir 2 tertanggal 29 april 2013


input1.php

<?php
echo"<form method='post' action='segitigabintang.php'>";
echo"<input type='number' name='nilai'>"."<br>";

echo"<input type = 'submit' value = 'submit'>";
echo"<input type = 'reset' value = 'reset'>";
?>

segitiga.php
<?php
$nilai=$_POST['nilai'];
for($x=1;$x<=$nilai;$x++)
{
for($y=1;$y<=$x;$y++)
{echo "%^&";}
echo"<br>";
}
?>



input2.php
<?php
echo"<form method='post' action='kalku.php'>";
echo"<input type='number' name='bil1'>"."<br>";
echo"<input type='number' name='bil2'>"."<br>";
echo"<input type = 'submit' name = 'tambah' value = 'tambah'>";
echo"<input type = 'submit' name = 'kali' value ='kali'>"."<br>";
echo"<input type = 'submit' name = 'kurang' value ='kurang'>";
echo"<input type = 'submit' name = 'bagi' value ='bagi'>";
?>

kalku.php
<?php
$bil1 = $_POST['bil1'];
$bil2 = $_POST['bil2'];
if ($tambah = $_POST['tambah'])
{
$hasil = $bil1 + $bil2 ;
echo $bil1." + ".$bil2." = ".$hasil;
}
if ($kurang = $_POST['kurang'])
{
$hasil =$bil1-$bil2;
echo $bil1." – ".$bil2." = ".$hasil;
}
if ($kali = $_POST['kali'])
{
$hasil = $bil1 * $bil2 ;
echo $bil1." x ".$bil2." = ".$hasil;
}
if ($bagi = $_POST['bagi'])
{
$hasil = $bil1 / $bil2 ;
echo $bil1." / ".$bil2." = ".$hasil;
}
?>