Prokom2-Tugas-4 (Siti Rosidah 4112313033)

15
PROKOM2-TUGAS-4 Disusun oleh : Nama : Siti Rosidah NIM : 4112313033 Prodi : Staterkom

description

Prokom2-Tugas-4 (Siti Rosidah 4112313033)

Transcript of Prokom2-Tugas-4 (Siti Rosidah 4112313033)

Page 1: Prokom2-Tugas-4 (Siti Rosidah 4112313033)

PROKOM2-TUGAS-4

Disusun oleh :

Nama : Siti Rosidah

NIM : 4112313033

Prodi : Staterkom

Page 2: Prokom2-Tugas-4 (Siti Rosidah 4112313033)
Page 3: Prokom2-Tugas-4 (Siti Rosidah 4112313033)
Page 4: Prokom2-Tugas-4 (Siti Rosidah 4112313033)
Page 5: Prokom2-Tugas-4 (Siti Rosidah 4112313033)
Page 6: Prokom2-Tugas-4 (Siti Rosidah 4112313033)

indeks.php

<html>

<head>

<title>SITI ROSIDAH</title>

<link rel='stylesheet'href='style.css'/>

</head>

<body>

<div id="header">SITI ROSIDAH <br> <marquee><font style="font-size:24px;text-

shadow: 5px 5px #CC0000;;font-family:forte;">Selamat Datang di Web Statistika Terapan dan

Komputasi 2013 </font></marquee> </br> </div>

<div id="sidebar"><a href="index.php?page=table">FORM NILAI</a><br><br>

<a href="index.php?page=input">FORM PENDAFTARAN</a><br><br>

<a href="index.php?page=formkuis">FORM KUIS</a ><br><br>

<a href="index.php?page=inputdivisi">FORM TAMBAH DIVISI</a ><br><br>

<a href="index.php?page=formtambahpengguna">FORM TAMBAH PENGGUNA</a

><br><br><br><br>

<div class="img">

<a target="_blank" href="Statistik_big.htm">

<img src="http://1.bp.blogspot.com/-

0PN4o7UAnxU/TsXXm3o5DHI/AAAAAAAAAGw/JGub72q3zC0/s1600/statistik3.PNG"

alt="Statistik" width="150" height="160">

</a> </br>

<div id="content"><html>

<?php

Page 7: Prokom2-Tugas-4 (Siti Rosidah 4112313033)

$page=$_GET ['page'];

require $page.".php";

?>

</div>

<div id="footer">Copyright @ST Rosidah </div>

</form>

</body>

</html></div>

style.css

#header {

height :150px;

background-color : #CC0066;

color : white;

padding-left : 20px;

padding-top:-10px;

padding-bottom:-80px;

width : 1310px;

font-family : Karnac One;

font-size : 65px;

text-align :center;

}

Page 8: Prokom2-Tugas-4 (Siti Rosidah 4112313033)

#sidebar {

height : 1900px;

background-color : #CC3399;

width : 180px;

color : black;

padding : 70px;

font-family : calibri;

}

#content {

margin-left : 240px;

margin-top : -462px;

height : 2000px;

background-color :#FFCCFF;

width : 971px;

padding: 25px;

font-family : Kristen ITC;

font-size : 20px;

}

#footer {

font-family : comic sans ms;

color:white;

Page 9: Prokom2-Tugas-4 (Siti Rosidah 4112313033)

padding :5px;

width : 1320px;

margin-left : -70px;

background-color :#CC0033;

text-align : center;

margin-top:-10px;

}

inputdivisi.php

<form action ='index.php?page=databasedivisi'method='post'>

<table>

<head><br> FORM TAMBAH DIVISI</head><br></br>

<tr>

<td> Nama Divisi </td>

<td>:</td>

<td><input type ="text" name= "nama_divisi"></td>

</tr>

<tr>

<td> Pimpinan Divisi </td>

<td>:</td>

<td><input type ="text" name= "pimpinan"></td>

<tr>

<td></td>

Page 10: Prokom2-Tugas-4 (Siti Rosidah 4112313033)

<td></td>

<td><input type="Submit" /></td>

</tr>

</table>

</form >

databasedivisi.php

<?php

require("koneksi.php");

// INSERT KE TABEL DIVISI (SQL QUERY)

$nama = $_POST['nama_divisi'];

$pimpinan = $_POST['pimpinan'];

$pdo->exec('

INSERT INTO

referensi (kode_divisi,nama_divisi,pimpinan)

VALUES (

" ",

" ' .$nama.' ",

" ' .$pimpinan.' ")

');

echo "Data SUKSES disimpan";

?>

Page 11: Prokom2-Tugas-4 (Siti Rosidah 4112313033)

koneksi.php

<?php

// KONEKSI KE DATABASE ==> PDO

$user = 'root';

$host = 'localhost';

$pwd = '';

$db = 'latihan1';

$pdo = new PDO ('mysql:host='.$host.';dbname='.$db.';charset=utf8',

$user,

$pwd

);

?>

bacadivisi.php

<?php

// KONEKSI KE DATABASE

require("koneksi.php");

// QUERY SQL KE TABEL REFERENSI

Page 12: Prokom2-Tugas-4 (Siti Rosidah 4112313033)

// INSERT KE TABEL REFERENSI (SQL QUERY)

$query = $pdo->query('

SELECT * FROM referensi

');

// CONVERT KE ARRAY

$referensi = $query->fetchALL(PDO::FETCH_ASSOC);

// LOOPING ARRAY DIVISI

foreach($referensi as $row)

{

echo $row['kode_divisi']."==>".$row['nama_divisi']."<br/>";

}

?>

formtambahpengguna.php

<form action ='index.php?page=prosespengguna'method='post'>

<table>

<head><br> FORM TAMBAH PENGGUNA</head><br></br>

<tr>

<td> Nama </td>

<td>:</td>

Page 13: Prokom2-Tugas-4 (Siti Rosidah 4112313033)

<td><input type ="text" name= "nama"></td>

</tr>

<tr>

<td> Username </td>

<td>:</td>

<td><input type ="text" name= "username"></td>

<tr>

<tr>

<td> Password </td>

<td>:</td>

<td><input type ="password" name= "password"></td>

<tr>

<tr>

<td> Divisi</td>

<td>:</td>

<td>

<select name ="referensi">

<?php

// KONEKSI KE DATABASE

require("koneksi.php");

// QUERY SQL KE TABEL REFERENSI

// INSERT KE TABEL REFERENSI (SQL QUERY)

$query = $pdo->query('

SELECT * FROM referensi

Page 14: Prokom2-Tugas-4 (Siti Rosidah 4112313033)

');

// CONVERT KE ARRAY

$referensi = $query->fetchALL(PDO::FETCH_ASSOC);

// LOOPING ARRAY DIVISI

foreach($referensi as $row)

{

echo '<option

value="'.$row['kode_divisi'].'">'.$row['nama_divisi'].'</option>';

}

?>

</select>

</td>

</tr>

<tr>

<td></td>

<td></td>

<td><input type="Submit" /></td>

</tr>

</table>

</form >

Page 15: Prokom2-Tugas-4 (Siti Rosidah 4112313033)

prosespengguna.php

<?php

require("koneksi.php");

// INSERT KE TABEL DIVISI (SQL QUERY)

$nama = $_POST['nama'];

$username = $_POST['username'];

$password = $_POST['password'];

$divisi = $_POST['referensi'];

$pdo->exec ('

INSERT INTO

master(nama,username,password,divisi)

VALUES (

" ' .$nama.' ",

" ' .$username.' ",

" ' .$password.' ",

" ' .$divisi.' ")

');

echo "Data SUKSES disimpan";

?>