Tugas Kelompok P-Web

Kelompok :

  1. Pipin Irwandi (11018162)
  2. Fajar Eko Susilo (11018138)
  3. Amin Padmoazam Masa (11018151)
  4. Radhian Prayogo (11018155)
  5. Singgih Saputra (11018148)

1. Membuat prompt menggunakan ASP di HTML

<html>
<head></head>
<body>
<%
I=prompt(“Nilai I”,””); X=parseFloat(I)
J=prompt(“Nilai J”,””); Y=parseFloat(J)
document.write(“Nilai I : “+X+ “Nilai J:”+Y)
if(X==Y){
response.write(“nilai I sama dengan nilai J”);
}
else if(X<Y){
response.write(“Nilai I kurang dari nilai J”);
}
else{
response.write(“Nilai I lebih dari nilai J”);
}
%>

</script>
</body>
</html>


2. Membuat perulangan For, While, dan Do…While.

<html>
<body><form action=”lopp.php” method=”post”>
Masukan Nilai awal: <input type=”text” name=”fname” />
<input type=”submit” />
</form>

</body>
</html>

(loop.php)

<?php
echo “Perulangan While <br><br>”;
$i = $_POST[‘fname’];
while($i<=10)
{
echo “The number is ” . $i . “<br />”;
$i++;
}
echo”<br><br>”;

echo “Perulangan Do..While <br><br>”;

$i =$_POST[‘fname’];
do
{
$i++;
echo “The number is ” . $i . “<br />”;
}
while ($i<=10);

echo”<br><br>”;

echo “Perulangan For <br><br>”;
for ($i = $_POST[‘fname’];  $i<=10; $i++)
{
echo “The number is ” . $i . “<br />”;
}
?>

3. Membuat Function dengan PHP

<html>
<head>
<title>Tugas P.Web</title>
</head>
<body>
<?
function tanggal(){
$hari=array(“Minggu”,”Senin”,”Selasa”,”Rabu”,”Kamis”,”Jum’at”,”Sabtu”);
$bulan=array(“”,”Januari”,”Februari”,”Maret”,”April”,”Mei”,”Juni”,”Juli”,”Agustus”,”September”,
“Oktober”,”November”,”Desember”);
$tgl=getdate();
echo $hari[$tgl[‘wday’]].”,$tgl[mday]-“.$bulan[$tgl[‘mon’]].”-$tgl[year]”;
}
?>Sekarang : <?php tanggal();?><br>
<?php
function nama () {
function x() {
echo “I am Love Web Programing.”;
}
echo “Never Ending.<br/>”;
}
nama();
x();
?>

<?php

$op2 = blabla;
$op3 = blabla;

function foo($op1)
{
global $op2, $op3;

echo $op1;
echo $op2;
echo $op3;
}
?>

<form name=”form1″ method=”post” action=”opp.php”>
<p>Operator matematika </p>
<p>
<input name=”x” type=”text” id=”x”>
<select name=”operator” id=”operator”>
<option>+</option>
<option>-</option>
<option>*</option>
<option>/</option>
</select>
<input name=”y” type=”text” id=”y”>
<input type=”submit” name=”Submit” value=”Hitung”>
</p>
</form>

</body>

</html>

oop.php

<?

function write()
{
echo “Membuat Funtion di PHP”;
}

echo “Tugas Pemrogramanan Web”;
write();
echo”<br>”;
echo”<br>”;

function operator($x, $y) {
$x = $_POST[‘x’];
$y = $_POST[‘y’];
$operator = $_POST[‘operator’];
if ($operator == ‘+’) {
$z=$x+$y;
echo “Hasil $x + $y = $z<br>”;
}
if ($operator == ‘-‘) {
$z=$x-$y;
echo “Hasil $x – $y = $z<br>”;
}
if ($operator == ‘*’) {
$z=$x*$y;
echo “Hasil $x * $y = $z<br>”;
}
if ($operator == ‘/’) {
$z=$x/$y;
echo “Hasil $x / $y = $z<br>”;
}
}
operator($x = $_POST[‘x’],$y = $_POST[‘y’]);

?>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s