Kelompok :
Hasil ouputnya seperti ini :
2. Perulangan for, while, dan do while dalam php
Hasil outputnya : 15
Hasil outputnya : 123456789
Hasil outputnya : 123456789
3. Fungsi-fungsi php
Hasil outputnya seperti ini :
- Eko Febri Nur W 11018135
- Agus Triyono 11018140
- Lalu Wahyu Reza Pratama 11018144
- Dimas Nugroho Setyadi W.A 11018158
01 | <html> |
02 | <head> |
03 | <title>Form Input</title> |
04 | </head> |
05 | <body> |
06 | <form method= "get" action= "simpleform.asp" > |
07 | <table> |
08 | <tr> |
09 | <td>Nama</td><td><input type= "text" value= "" name= "Nama" ></td> |
10 | </tr> |
11 | <tr> |
12 | <td>Alamat</td><td><input type= "text" value= "" name= "Alamat" ></td> |
13 | </tr> |
14 | <tr> |
15 | <td>Telp</td><td><input type= "text" value= "" name= "Telp" ></td> |
16 | </tr> |
17 | <tr> |
18 | <td>Jenis Kelamin</td><td><input type= "radio" value= "L" name= "jenis kelamin" >Laki-laki</td> |
19 | <td><input type= "radio" value= "P" name= "jenis kelamin" >Perempuan</td> |
20 | </tr> |
21 | <tr><td> |
22 | Agama <td><select name= "Agama" > |
23 | <option>Islam</option> |
24 | <option>Kristen</option> |
25 | <option>Katolik</option> |
26 | <option>Hindu</option> |
27 | <option>Budha</option></td> |
28 | </td></tr> |
29 | </select> |
30 | <tr><td> |
31 | Prestasi Yang Pernah diraih <td><textarea></textarea></td> |
32 | </td></tr> |
33 | </table> |
34 | <input type= "submit" value= "Simpan" > |
35 | <input type= "button" value= "Batal" > |
36 |
37 | </table> |
38 | </form> |
39 | </body> |
40 | </html> |
2. Perulangan for, while, dan do while dalam php
- Perulangan for php
1 | <?php |
2 | $n= 0 ; |
3 | for($i= 1 ; $i<= 5 ; $i++) |
4 | { |
5 | $n=$n+$i; |
6 | } |
7 | echo "$n" ; |
8 | ?> |
- Perulangan while php
1 | <?php |
2 | $x = 0 ; |
3 | while($x != 10 ) |
4 | { |
5 | echo $x; |
6 | $x++; |
7 | } |
8 | ?> |
- Perulangan do while php
1 | <?php |
2 | $x = 0 ; |
3 | do |
4 | { |
5 | echo $x; |
6 | $x++; |
7 | } |
8 | while($x != 10 ) |
9 | ?> |
3. Fungsi-fungsi php
01 | <?php |
02 | function writeName() |
03 | { |
04 | echo "Slamet" . "<br/>" ; |
05 | } |
06 | echo "Nama Saya Adalah : " ; |
07 | writeName(); |
08 |
09 | function add($x,$y) |
10 | { |
11 | $total=$x+$y; |
12 | return $total; |
13 | } |
14 | echo "50 + 50 = " . add( 50 , 50 ). "<br/>" ; |
15 | function kurang($x,$y) |
16 | { |
17 | $total=$x-$y; |
18 | return $total; |
19 | } |
20 | echo "50 - 50 = " . kurang( 50 , 50 ). "<br/>" ; |
21 | echo "Today is " .date( "d-F-Y" ). "<br/>" ; |
22 | $tomorrow = mktime( 0 , 0 , 0 ,date( "m" ),date( "d" )+ 1 ,date( "Y" )); |
23 | echo "Tomorrow is " .date( "d-F-Y" , $tomorrow). "<br/>" ; |
24 | $str= "saya mahasiswa uad" ; |
25 | echo "Kalimat : " .($str). "<br/>" . "Dibalik : " .strrev($str). "<br/>" ; |
26 | ?> |
Tidak ada komentar:
Posting Komentar