Berikut program untuk menentukan gaji karyawan berdasarkan golongan.
Ketikan kode berikut:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | <?php @$golongan = $_POST['golongan']; ?> <!DOCTYPE html> <html> <head> <title>Gaji Karyawan</title> </head> <body> <form method="POST"> Masukan nilai = <select name="golongan"> <option <?php if($golongan == 'IA'){echo 'selected';} ?>>IA</option> <option <?php if($golongan == 'IB'){echo 'selected';} ?>>IB</option> <option <?php if($golongan == 'IC'){echo 'selected';} ?>>IC</option> <option <?php if($golongan == 'ID'){echo 'selected';} ?>>ID</option> <option <?php if($golongan == 'IIA'){echo 'selected';} ?>>IIA</option> <option <?php if($golongan == 'IIB'){echo 'selected';} ?>>IIB</option> <option <?php if($golongan == 'IIC'){echo 'selected';} ?>>IIC</option> <option <?php if($golongan == 'IID'){echo 'selected';} ?>>IID</option> <option <?php if($golongan == 'IIIA'){echo 'selected';} ?>>IIIA</option> <option <?php if($golongan == 'IIIB'){echo 'selected';} ?>>IIIB</option> <option <?php if($golongan == 'IIIC'){echo 'selected';} ?>>IIIC</option> <option <?php if($golongan == 'IIID'){echo 'selected';} ?>>IIID</option> <option <?php if($golongan == 'IVA'){echo 'selected';} ?>>IVA</option> <option <?php if($golongan == 'IVB'){echo 'selected';} ?>>IVB</option> <option <?php if($golongan == 'IVC'){echo 'selected';} ?>>IVC</option> <option <?php if($golongan == 'IVD'){echo 'selected';} ?>>IVD</option> <option <?php if($golongan == 'IVE'){echo 'selected';} ?>>IVE</option> </select> <input type="submit" name="submit" value="SUBMIT"/><br/><br/> <?php if ($golongan == "") { echo ""; } else if ($golongan == "IA") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 1.446.500'; } else if ($golongan == "IB") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 1.531.500'; } else if ($golongan == "IC") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 1.596.300'; } else if ($golongan == "ID") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 1.663.800'; } else if ($golongan == "IIA") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 1.845.600'; } else if ($golongan == "IIB") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 1.984.200'; } else if ($golongan == "IIC") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 2.068.100'; } else if ($golongan == "IID") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 2.155.600'; } else if ($golongan == "IIIA") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 2.390.600'; } else if ($golongan == "IIIB") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 2.491.700'; } else if ($golongan == "IIIC") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 2.597.100'; } else if ($golongan == "IIID") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 2.706.900'; } else if ($golongan == "IVA") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 2.821.400'; } else if ($golongan == "IVB") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 2.940.800'; } else if ($golongan == "IVC") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 3.065.600'; } else if ($golongan == "IVD") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 3.194.800'; } else if ($golongan == "IVE") { echo 'Golongan : ' . $golongan . '<br/>Gaji = 3.330.000'; } ?> </form> </body> </html> |
Pada kode diatas, nilai gaji dapat diubah.
Hasil akhirnya adalah sebagai berikut:
No comments:
Post a Comment