Dhiika04
Coding Form Edit php - Dhiika04

Image

Follow Us

About Me

Followers

Blog Archive

DhikAnime Tempatnya Nostalgia Kartun Dulu, Masa Kecil adalah Kenangan yang sangat indah.

Coding Form Edit php

Post a Comment

 <?php

include ("config.php");

if ( !isset($_GET['id'])){

header ('location: list-siswa.php');

}

$id = $_GET['id'];

$sql = "SELECT * FROM calon_siswa WHERE id=$id";

$query = mysqli_query($conn,$sql);

$siswa = mysqli_fetch_assoc($query);

if( mysqli_num_rows($query) <1 ){

die ("Data Tidak Ditemukan");

}

?>

<!doctype html>

<html>

<head>

<tittle>Form Edit Data</tittle>

</head>


<body>

<header>

<h3>Formulir Edit Data Pendaftaran Siswa Baru</h3>

</header>


<form action ="proses-edit.php" method="POST">


<fieldset>


<input type ="hidden" name="id" value =" <?php echo $siswa['id'] ?> " />


<p>

<laber for="nama">Nama : </label>

<input type="text" name="nama" placeholder="Nama Lengkap" value ="<?php echo $siswa['nama'] ?>" />

</p>


<p>

<label for="alamat">Alamat : </label>

<textarea name="alamat"><?php echo $siswa['alamat'] ?></textarea>

</p>


<p>

<label for="jenis_kelamin">Jenis Kelamin : </label> <?php $jk=$siswa['jenis_kelamin']; ?>


<label> <input type="radio" name="jenis_kelamin" value ="laki-laki" <?php echo ($jk == 'laki-laki')? "checked": "" ?>> Laki-laki</label>


<label> <input type="radio" name="jenis_kelamin" value ="perempuan" <?php echo ($jk == 'perempuan')? "checked": "" ?>> Perempuan</label>

</p>


<p>

<label for="agama">Agama : </label> <?php $agama = $siswa['agama']; ?>


<select name="agama">

<option <?php echo ($agama == 'Islam')? "selected": ""?> >Islam</option>


<option <?php echo ($agama == 'Kristen')? "selected": ""?>>Kristen</option>


<option <?php echo ($agama == 'Budha')? "selected": ""?>>Budha</option>


<option <?php echo ($agama == 'Hindu')? "selected": ""?>>Hindu</option> </select>

</p>


<p>

<label for="sekolah_asal">Sekolah Asal : </label>

<input type="text" name="sekolah_asal" placeholder="Nama Sekolah" value= "<?php echo $siswa['sekolah_asal'] ?>" />

</p>


<p>

<input type="submit" value="Simpan" name="simpan" />

</p>


</fieldset>

</form>

</body>

</html>


Related Posts

Post a Comment