This page explanation:
You can delete the information.
※Click the Delete button to receive an alert.
※Click “OK” on the alert to delete data.
This page function:
Delete
① Controller
Controller:/app/controller/customerController.php
class customer{
//…ellipsis…
public function action_delete($targetId){ //deleted function
//get data ※idiorm libraly
$custmanageObj = ORM::for_table(customer)->where('id', $targetId)->find_one();
//Logical deletion by setting “delete_flg” to 1.
$custmanageObj->delete_flg = 1;
$custmanageObj->save();
redirectUrl('customer');//class “customer” to redirect.
}
}
② View
View:/app/view/customer_edit.php
※next page for details.
<form method='post' action=''<?= SYSTEM_DIR . '/customer/update/'.$targetId; ?>''>
<button type="button" class="btn btn-success " id="update-btn">更新</button>
<button type="button" class="btn btn-danger" id="delete-btn" >削除</button>
//…ellipsis…
</form>
//…ellipsis…
<script>//this section is javascript coding zone
$('#delete-btn').on('click',function() {
if(!confirm('本当に、削除してもよろしいですか?')){
//…ellipsis…
window.location.href = "../delete/"+targetid;
}
})
