예제 #1
0
echo isset($_GET['id']) ? 'Update' : 'Add';
?>
 Capital</h3>
		  </div>
		  <div class="panel-body">
			<?php 
$accounts = new accounts();
$ID = isset($_GET['id']) ? $_GET['id'] : NULL;
if (isset($_POST['add_capital'])) {
    $name = $_POST['capital_name'];
    $amount = $_POST['capital_amount'];
    $date = $_POST['capital_date'];
    $detail = $_POST['capital_detail'];
    // Update old record
    if (isset($ID)) {
        $results = $accounts->update_capital($name, $amount, $date, $detail, $ID);
    } else {
        // Insert new
        $results = $accounts->create_capital($name, $amount, $date, $detail);
    }
    if ($results) {
        echo '<div class="alert alert-success" role="alert"> Add Capital Sucessfully </div>';
    } else {
        echo '<div class="alert alert-danger" role="alert"> Error </div>';
    }
}
if (isset($ID)) {
    $capital_result = $accounts->get_capital($ID);
}
?>
			<div class="the-box noborder">