<?php
// konfigurasi utk koneksi ke database
$connect = mysqli_connect(“localhost”, “dumet”, “school”, “test”);
// bagi proses insert
if(isset($_POST[“btn_add”]))
{
$insertSql = “CALL insertCountry(‘”.$_POST[“country_name”].“‘)”;
if(mysqli_connect($connect, $insertSql))
{
header(“location:index.php?inserted=1”);
}
}
?>
<!doctype html>
<html lang=“en”>
<head>
<!— Required meta tags —>
<meta charset=“utf-8”>
<meta name=“viewport” content=“width=device-width, initial-scale=1, shrink-to-fit=no”>
<!— Bootstrap CSS —>
<link rel=“stylesheet” href=“https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css”>
<title>Membangun CRUD Dengan Stored Procedure Di PHP MySQL</title>
<style>
*{
margin:0;
padding:0;
}
.box{
width: 500px;
border: 1px solid #ccc;
border-radius: 5px;
}
</style>
</head>
<body>
<div class=“container box my-5”>
<form action=“” name=“add_country0”>
<h3 class=“text-center”>Input Data Negara</h3>
<div class=“form-group”>
<input type=“text” name=“country_name” class=“form-control”>
</div>
<div class=“form-group text-center”>
<input type=“submit” class=“form-control bg-info text-white font-weight-bold” name=“btn_add” value=“Add”>
</div>
</form>
<div class=“table-responsive”>
<table class=“table table-striped”>
<tr>
<th>Nama Negara</th>
<th>Modifikasi</th>
<th>Delete</th>
</tr>
<?php
$selectSql = “CALL selectCountry()”;
$selectResult =
mysqli_query
(Visited 66 times, 1 visits today)