echo "<div class='container'>";
 echo "<div class='col-md-9'>";
 if ($_POST) {
     //public $cust_kode, $cust_nama, $cust_alamat, $cust_jk, $cust_tempat, $cust_dob, $isactive;
     include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/customer.php';
     $customer = new customer($db);
     $customer->cust_kode = $_POST['cust_kode'];
     $customer->cust_nama = $_POST['cust_nama'];
     $customer->cust_alamat = $_POST['cust_alamat'];
     $customer->cust_jk = $_POST['cust_jk'];
     $customer->cust_tempat = $_POST['cust_tempat'];
     $customer->cust_dob = $_POST['cust_dob'];
     //tanggal lahir pelanggan
     $customer->isactive = $_POST['isactive'];
     //fungsi insert data pelanggan
     if ($customer->insert()) {
         echo "<div class='alert alert-success alert-dismissable'>";
         echo "<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>";
         echo "Pelanggan Baru berhasil di Tambah";
         echo "</div>";
     } else {
         echo "<div class='alert alert-danger alert-dismissable'>";
         echo "<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>";
         echo "pelanggan Baru gagal di tambah";
         echo "</div>";
     }
 }
 echo "<div class='row'>";
 echo "<form id='form_reg' class='form-horizontal' action='' method='POST' role='form'>";
 echo "<legend class='text-center'>Tambah Data Pelanggan</legend>";
 //dari sini
Exemple #2
0
?>
</h1>

<?php 
$customerInst = new customer();
#######################################################################
## perform action
$status = 1;
if (tool::securePost('action') == "save" && tool::securePost('id')) {
    # fill customer with submitted data
    $customerInst->id = tool::securePost('id');
    $customerInst->fill(tool::securePostAll());
    $status = $customerInst->update();
} elseif (tool::securePost('action') == "save") {
    $customerInst->fill(tool::securePostAll());
    $status = $customerInst->insert();
}
if (tool::securePost('action') == "delete") {
    $customerInst->id = tool::securePost('id');
    $customerInst->delete();
}
if (tool::securePost('action') == "edit") {
    $status = 0;
    $customerInst->activate(tool::securePost('id'));
}
#######################################################################
## make edit / new form
if (!$status) {
    echo "<h2>" . $lang['common_editRecord'] . " (<a href=\"" . $toolInst->encodeUrl("index.php?content=" . $content) . "\">" . $lang['common_newRecord'] . "</a>)</h2>\n";
} else {
    $customerInst->clear();
     $validate->phone('phone', $phone);
     // Load appropriate view based on hasErrors
     if ($fields->hasErrors()) {
         include '../view/register.php';
     } else {
         /*
          $name = $_POST['name'];
          $age = $_POST['age'];
          $mail = $_POST['email'];
          $pass = md5($_POST['pass']);
          $address = $_POST['address'];
          $city = $_POST['city'];
          $phone = $_POST['phone'];
         */
         $add = new customer(Null, $name, $age, $email, $password, $address, $city, $phone);
         $result = $add->insert();
         header("location:?action=acc_login_form");
     }
     break;
 case "acc_login":
     $User = $_POST["email"];
     $Pass = md5($_POST["password"]);
     $ad = new customer();
     $ar = $ad->login($User, $Pass);
     if ($ar[0] == 0) {
         echo "Login Failed";
         include "../view/login_order.php";
     } else {
         if ($ar[0] == 1) {
             $_SESSION["\\/m&coppy;fptp\$02241"] = $ar[1];
             include "../view/home.php";
<?php

if ($_POST) {
    include_once $_SERVER['DOCUMENT_ROOT'] . '/objects/customer.php';
    $customer = new customer($db);
    $customer->cust_kode = $_POST['cust_kode'];
    $customer->cust_nama = $_POST['cust_nama'];
    $customer->cust_alamat = $_POST['cust_alamat'];
    $customer->cust_jk = $_POST['cust_jk'];
    $customer->cust_tempat = $_POST['cust_tempat'];
    $customer->cust_dob = $_POST['cust_dob'];
    //tanggal lahir pelanggan
    $customer->cust_hp = $_POST['cust_hp'];
    $customer->isactive = $_POST['isactive'];
    $customer->insert();
    header("refresh: 0");
}
?>

<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
				<h4 class="modal-title" id="myModalLabel">Tambah Data Pelanggan</h4>
			</div>
		<div class="modal-body">
			<form class="form-horizontal" action="" method="post">
				<div class="row">
<?php 
echo "<div class='form-group'>";
if (isset($_POST['update'])) {
    $fname1 = $_POST['fname1'];
    $lname1 = $_POST['lname1'];
    $address1 = $_POST['address1'];
    $telNo1 = $_POST['telNo1'];
    if (strlen($telNo1) < 1) {
        $addError[] = "Enter Tel No.";
    } elseif (strlen($fname1) < 1) {
        $addError[] = "Enter Firstname";
    } elseif (strlen($lname1) < 1) {
        $addError[] = "Enter Lastname";
    } elseif (strlen($address1) < 2) {
        $addError[] = "Enter Address";
    } else {
        $up = new customer(NULL, $fname1, $lname1, $address1, $telNo1);
        $up->insert();
    }
}
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <title>Costumer</title>

    <!-- Bootstrap core CSS -->