Buatlah file formulir dengan nama file entry.php
<html>
<head>
<title>HALAMAN ENTRY </title>
<style type="text/css">
.labelfrm{
display:block;
font-size:small;
margin-top:5px;
}
.error{
font-size:small;
color:red;
}
</style>
</head>
<body align="center">
<h1>FORMULIR SIMPAN</h1>
<form action="simpan.php" method="post" id="frm">
<table align="center">
<tr>
<td><label for="id" class="labelfrm">ID : </label></td>
<td><input type="text" name="id" id="id" maxlength="3" class="required" size="25"/></td>
</tr>
<tr>
<td><label for="nama" class="labelfrm">Nama : </label></td>
<td><input type="text" name="nama" id="nama" maxlength="25" class="required" size="25"/></td>
</tr>
<tr>
<td><label for="alamat" class="labelfrm" >Alamat : </label></td>
<td><input type="text" name="alamat" id="alamat" size="50" class="required"/></td>
</tr>
<tr>
<td><label for="tahun" class="labelfrm">Tahun : </label></td>
<td><input type="text" name="tahun" id="tahun" size="4" class="required"/></td>
</tr>
<tr>
<td><label for="kelas" class="labelfrm">Kelas : </label></td>
<td><input type="text" name="kelas" id="kelas" size="3" class="required"/></td>
</tr>
<tr>
<td><label for="rombel" class="labelfrm">Rombel : </label></td>
<td><input type="text" name="rombel" id="rombel" size="1" class="required"/></td>
</tr>
<tr>
<td><input type="submit" name="input" value="Simpan" id="input"/></td>
<td><input type="reset" name="clear" value="clear" id="clear"/></td>
</table>
</form>
<br><br>
</table>
<br><br><br>
<?
}
?>
</body>
</html>
Buatlah file simpan.php sebagai code untuk menyimpan dari form ke database
<?php
include "koneksi.php";
$id = $_POST['id'];
$nama = $_POST['nama'];
$alamat = $_POST['alamat'];
$tahun = $_POST['tahun'];
$kelas = $_POST['kelas'];
$rombel = $_POST['rombel'];
$sql = "Insert Into siswa values('$id','$nama','$alamat','$tahun','$kelas','$rombel')";
if(mysqli_query($dbconnect, $sql)){
echo "Records inserted successfully.";
echo "<script> location.replace('tampil.php'); </script>";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($dbconnect);
}
// Close connection
mysqli_close($dbconnect);
?>
Langganan:
Posting Komentar (Atom)
Sudah jadi pak ini linknya
BalasHapushttps://amelia-maulida.000webhostapp.com/latihan/tampil.php
PHP MySQL bagian 4 : Menambah kolom dan data di database di phpmyadmin
HapusTugas by: Amelia Maulida Wulandari XI TKJ
ini yang entry pak
BalasHapushttps://amelia-maulida.000webhostapp.com/latihan/entry.php dan ini hasilnya pak https://amelia-maulida.000webhostapp.com/latihan/tampil.php
Tugas by: Amelia Maulida Wulandari XI TKJ
PHP MySQL bagian 5 membuat Form Entry data dan kode simpan
HapusTugas by: Amelia Maulida Wulandari XI TKJ
Entry Dan Tampil Pak
BalasHapushttps://tok-dalang.000webhostapp.com/latihan/entry.php
https://tok-dalang.000webhostapp.com/latihan/tampil.php
Tugas Widi Maula
Entry dan Tampil Pak
BalasHapushttps://syahsiregar.000webhostapp.com/latihan/entry.php
https://syahsiregar.000webhostapp.com/latihan/tampil.php
Tugas Alfiyan Syah Putra Siregar
Komentar ini telah dihapus oleh pengarang.
BalasHapushttps://devidianti.000webhostapp.com/latihan/entry.php
BalasHapushttps://devidianti.000webhostapp.com/latihan/tampil.php
Tugas Devi Nurdianti
NOVITA SALBIANTI
BalasHapushttps://salbianti.000webhostapp.com/latihan/tampil.php
https://salbianti.000webhostapp.com/latihan/entry.php
Tugas by: Febriani
BalasHapusPHP MYSQL 4
https://febriiani.000webhostapp.com/latihan/tampil.php
PHP MYSQL 5
tugas : https://febriiani.000webhostapp.com/latihan/entry.php
hasil : https://febriiani.000webhostapp.com/latihan/tampil.php
https://sitimuasaroh.000webhostapp.com/entry.php
BalasHapushttps://sitimuasaroh.000webhostapp.com/tampil.php
tugas sitimuasaroh
https://aniskhoirunnisa111.000webhostapp.com/latihan/entry.php
BalasHapushttps://aniskhoirunnisa111.000webhostapp.com/latihan/tampil.php
khoirunnisa