Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Aplikasi Sekolah - CRUD Tambah Kelas</title>
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
- </head>
- <body>
- <div class="container">
- <div class="row">
- <div class="col-10">
- <h1>Edit Kelas</h1>
- </div>
- <div class="col-2">
- <a href="." class="btn btn-md btn-primary">Kembali</a>
- </div>
- </div>
- <?php
- include_once("../koneksi.php");
- $nis = $_GET['nis'];
- $sql = "SELECT * FROM siswa WHERE nis='$nis'";
- $query = mysqli_query($koneksi, $sql);
- $row = mysqli_fetch_assoc($query);
- ?>
- <div class="row">
- <form action="update.php" method="POST">
- <div class="form-group">
- <label for="">NIS</label>
- <input type="number" class="form-control" name="nis" value="<?php echo $row['nis']; ?>" disabled>
- </div>
- <div class="form-group">
- <label for="">Nama Siswa</label>
- <input type="text" class="form-control" name="nama" value="<?php echo $row['nama']; ?>">
- </div>
- <div class="form-group">
- <label for="">Jenis Kelamin</label>
- <input type="radio" name="gender" value="Laki-laki" <?php echo $row['gender']=='Laki-laki'?'checked':'' ?>>Laki-laki
- <input type="radio" name="gender" value="Perempuan" <?php echo $row['gender']=='Perempuan'?'checked':'' ?>>Perempuan
- </div>
- <div class="form-group">
- <label for="">Tempat Lahir</label>
- <input type="text" class="form-control" name="tempat_lahir" value="<?php echo $row['tempat_lahir']; ?>">
- </div>
- <div class="form-group">
- <label for="">Tanggal Lahir</label>
- <input type="date" class="form-control" name="tanggal_lahir" value="<?php echo $row['tanggal_lahir']; ?>">
- </div>
- <div class="form-group">
- <label for="">Kelas</label>
- <select name="kelas_id" class="form-control" required>
- <option value="">--Pilih Kelas--</option>
- <?php
- include_once('../koneksi.php');
- $sql = "SELECT * FROM kelas ORDER BY kelas ASC";
- $result = mysqli_query($koneksi, $sql);
- foreach($result as $r) {
- echo "<option value=" . $r['id'] . $r['id']==$row['kelas_id']?' selected ':'' . ">" . $r['kelas'] . "</option>";
- }
- ?>
- </select>
- </div>
- <div class="form-group mt-2">
- <input type="reset" class="btn btn-md btn-warning">
- <input type="submit" value="Update" class="btn btn-md btn-primary" name="update">
- </div>
- </form>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement