Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "header.template.php";
- ?>
- <!-- forminsert.php
- -->
- <form method="get" action="">
- ID
- <input name="IDPelajar" type="text"
- class="form-control">
- Nama pelajar
- <input name="NamaPel" type="text"
- class="form-control">
- Alamat
- <input name="Alamat" type="text"
- class="form-control">
- <input type="submit" value="Simpan"
- class="btn btn-primary">
- </form>
- <hr>
- <?php
- include "connection.php";
- //verify ada data tidak dalam form
- if (isset($_GET['IDPelajar'])){
- //capture all data
- $id=$_GET['IDPelajar'];
- $nama=$_GET['NamaPel'];
- $alamat=$_GET['Alamat'];
- //sql command to create new record
- $sql="INSERT INTO pelajar
- (IDPelajar, NamaPel, Alamat)
- VALUES
- ('$id','$nama','$alamat')";
- //run sql
- $rs = mysqli_query($db, $sql);
- if($rs==true){
- echo "Rekod jaya disimpan";
- }
- }
- ?>
- <?php
- include "footer.template.php";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement