ETS PWEB C
Nama : Arini Indah Nur Fuadah
NRP : 05111740007003
Kelas : C
1. Halaman Awal
2. Tampilan Input
3. Tampilan Output
4. Proses Input
==============================Hasil=================================
NRP : 05111740007003
Kelas : C
ETS PWEB
1. Halaman Awal
<!DOCTYPE html>
<html>
<head>
<title>Input Prestasi</title>
</head>
<body>
<header>
<h1>MANAJEMEN PENILAIAN</h1>
</header>
<h2>Menu</h2>
<nav>
<ul>
<li><a href="#">Input Data dan Nilai</a></li>
<li><a href="#">Input Kehadiran Siswa</a></li>
<li><a href="#">Input Nilai Ekstrakulikuler</a></li>
<li><a href="prestasi.php">Input Prestasi</a></li>
<li><a href="#">Catatan Wali Kelas</a></li>
</ul>
</nav>
</body>
</html>
<html>
<head>
<title>Input Prestasi</title>
</head>
<body>
<header>
<h1>MANAJEMEN PENILAIAN</h1>
</header>
<h2>Menu</h2>
<nav>
<ul>
<li><a href="#">Input Data dan Nilai</a></li>
<li><a href="#">Input Kehadiran Siswa</a></li>
<li><a href="#">Input Nilai Ekstrakulikuler</a></li>
<li><a href="prestasi.php">Input Prestasi</a></li>
<li><a href="#">Catatan Wali Kelas</a></li>
</ul>
</nav>
</body>
</html>
2. Tampilan Input
<!DOCTYPE html>
<html>
<head>
<title>Formulir Input Prestasi Siswa</title>
</head>
<body>
<header>
<h3>Formulir Input Prestasi Siswa</h3>
</header>
<form action="proses-input.php" method="POST">
<fieldset>
<p>
<label for="nama">Kelas: </label>
<input type="text" name="nama" placeholder="Kelas" />
</p>
<p>
<label for="Semester">Semester: </label>
<select name="Semester">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
</select>
</p>
<p>
<label for="nama">Nama: </label>
<input type="text" name="nama" placeholder="Nama Lengkap" />
</p>
<p>
<label for="nama">Prestasi: </label>
<input type="text" name="nama" placeholder="Jenis Prestasi" />
</p>
<p>
<label for="Keterangan">Keterangan: </label>
<textarea name="Keterangan"><?php echo $siswa['alamat'] ?></textarea>
</p>
<p>
<input type="submit" value="Simpan" name="Simpan" />
</p>
</fieldset>
</form>
</body>
</html>
<html>
<head>
<title>Formulir Input Prestasi Siswa</title>
</head>
<body>
<header>
<h3>Formulir Input Prestasi Siswa</h3>
</header>
<form action="proses-input.php" method="POST">
<fieldset>
<p>
<label for="nama">Kelas: </label>
<input type="text" name="nama" placeholder="Kelas" />
</p>
<p>
<label for="Semester">Semester: </label>
<select name="Semester">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
</select>
</p>
<p>
<label for="nama">Nama: </label>
<input type="text" name="nama" placeholder="Nama Lengkap" />
</p>
<p>
<label for="nama">Prestasi: </label>
<input type="text" name="nama" placeholder="Jenis Prestasi" />
</p>
<p>
<label for="Keterangan">Keterangan: </label>
<textarea name="Keterangan"><?php echo $siswa['alamat'] ?></textarea>
</p>
<p>
<input type="submit" value="Simpan" name="Simpan" />
</p>
</fieldset>
</form>
</body>
</html>
3. Tampilan Output
<?php include("config.php"); ?>
<!DOCTYPE html>
<html>
<head>
<title>Output Prestasi</title>
</head>
<body>
<header>
<h2>Data Prestasi Siswa</h2>
</header>
<nav>
<a href="proses-input.php">[+] Tambah Baru</a>
</nav>
<br>
<table border="1">
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Kelas</th>
<th>Semester</th>
<th>Prestasi</th>
<th>Keterangan</th>
<th>Aksi</th>
</tr>
</thead>
<!-- <tbody>
<?php
$sql = "SELECT * FROM calon_siswa";
$query = mysqli_query($db, $sql);
while($siswa = mysqli_fetch_array($query)){
echo "<tr>";
echo "<td>".$siswa['id']."</td>";
echo "<td>".$siswa['kelas']."</td>";
echo "<td>".$siswa['semester']."</td>";
echo "<td>".$siswa['nama']."</td>";
echo "<td>".$siswa['prestasi']."</td>";
echo "<td>".$siswa['keterangan']."</td>";
echo "<td>";
echo "<a href='form-edit.php?id=".$siswa['id']."'>Edit</a> | ";
echo "</td>";
echo "</tr>";
}
?>
</tbody> -->
</table>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Output Prestasi</title>
</head>
<body>
<header>
<h2>Data Prestasi Siswa</h2>
</header>
<nav>
<a href="proses-input.php">[+] Tambah Baru</a>
</nav>
<br>
<table border="1">
<thead>
<tr>
<th>No</th>
<th>Nama</th>
<th>Kelas</th>
<th>Semester</th>
<th>Prestasi</th>
<th>Keterangan</th>
<th>Aksi</th>
</tr>
</thead>
<!-- <tbody>
<?php
$sql = "SELECT * FROM calon_siswa";
$query = mysqli_query($db, $sql);
while($siswa = mysqli_fetch_array($query)){
echo "<tr>";
echo "<td>".$siswa['id']."</td>";
echo "<td>".$siswa['kelas']."</td>";
echo "<td>".$siswa['semester']."</td>";
echo "<td>".$siswa['nama']."</td>";
echo "<td>".$siswa['prestasi']."</td>";
echo "<td>".$siswa['keterangan']."</td>";
echo "<td>";
echo "<a href='form-edit.php?id=".$siswa['id']."'>Edit</a> | ";
echo "</td>";
echo "</tr>";
}
?>
</tbody> -->
</table>
</body>
</html>
4. Proses Input
<?php
include("config.php");
// cek apakah tombol daftar sudah diklik atau blum?
if(isset($_POST['Submit'])){
// ambil data dari formulir
$kelas = $_POST['kelas'];
$semester = $_POST['semester'];
$nama = $_POST['nama'];
$prestasi = $_POST['prestasi'];
$keterangan = $_POST['keterangan'];
// buat query
$sql = "INSERT INTO calon_siswa (kelas, semester, nama, prestasi, keterangan) VALUE ('$kelas', '$semester', '$nama', '$prestasi', '$keterangan')";
$query = mysqli_query($db, $sql);
// apakah query simpan berhasil?
if( $query ) {
// kalau berhasil alihkan ke halaman index.php dengan status=sukses
header('Location: index.php?status=sukses');
} else {
// kalau gagal alihkan ke halaman indek.php dengan status=gagal
header('Location: index.php?status=gagal');
}
} else {
die("Akses dilarang...");
}
5. Configinclude("config.php");
// cek apakah tombol daftar sudah diklik atau blum?
if(isset($_POST['Submit'])){
// ambil data dari formulir
$kelas = $_POST['kelas'];
$semester = $_POST['semester'];
$nama = $_POST['nama'];
$prestasi = $_POST['prestasi'];
$keterangan = $_POST['keterangan'];
// buat query
$sql = "INSERT INTO calon_siswa (kelas, semester, nama, prestasi, keterangan) VALUE ('$kelas', '$semester', '$nama', '$prestasi', '$keterangan')";
$query = mysqli_query($db, $sql);
// apakah query simpan berhasil?
if( $query ) {
// kalau berhasil alihkan ke halaman index.php dengan status=sukses
header('Location: index.php?status=sukses');
} else {
// kalau gagal alihkan ke halaman indek.php dengan status=gagal
header('Location: index.php?status=gagal');
}
} else {
die("Akses dilarang...");
}
<?php
$server = "localhost";
$user = "root";
$password = "";
$nama_database = "prestasi_siswa";
$db = mysqli_connect($server, $user, $password, $nama_database);
if( !$db ){
die("Gagal terhubung dengan database: " . mysqli_connect_error());
}
?>
$server = "localhost";
$user = "root";
$password = "";
$nama_database = "prestasi_siswa";
$db = mysqli_connect($server, $user, $password, $nama_database);
if( !$db ){
die("Gagal terhubung dengan database: " . mysqli_connect_error());
}
?>
==============================Hasil=================================
Komentar
Posting Komentar