<?php $id = $_GET['id']; $user = $_GET['user']; $ngaydat = $_GET['ngaydat']; $ngaygiao = $_GET['ngaygiao']; $nguoinhan = $_GET['nguoinhan']; $dienthoai = $_GET['dienthoai']; $diadiem = $_GET['diadiem']; $ghichu = $_GET['ghichu']; require_once '../../../libraries/oop.php'; require_once '../../../libraries/donhang.php'; $a = new DonHang(); $a->set_idDonHang($id); $a->set_Username($user); $a->set_ThoiDiemDatHang($ngaydat); $a->set_ThoiDiemGiaoHang($ngaygiao); $a->set_TenNguoiNhan($nguoinhan); $a->set_DienThoai($dienthoai); $a->set_DiaDiemGiaoHang($diadiem); $a->set_GhiChu($ghichu); if ($a->ThemDonHang()) { echo "18"; } else { echo "0"; }
if ($_POST['txtmxn'] == NULL || $_POST['txtmxn'] != $_SESSION["security_code"]) { $loi[] = "Mã xác nhận không đúng<br />"; } if ($loi != "") { echo "<ul>"; foreach ($loi as $err) { echo "<li>{$err}</li>"; } echo "</ul>"; } else { if ($tennn && $dt && $dc && $ngaygiao && $thanggiao && $namgiao) { //$tongtien = $_SESSION['thanhtien']; //$doilaitongtien = str_replace(",","",$tongtien); $donhang->set_idDonHang($idDonHang); $donhang->set_Username($_SESSION['username']); $donhang->set_TenNguoiNhan($tennn); $donhang->set_DienThoai($dt); $donhang->set_DiaDiemGiaoHang($dc); $ngaydat = date('d'); $thangdat = date('m'); $namdat = date('Y'); $dat = "{$namdat}-{$thangdat}-{$ngaydat}"; $donhang->set_ThoiDiemDatHang($dat); $giao = "{$namgiao}-{$thanggiao}-{$ngaygiao}"; $donhang->set_ThoiDiemGiaoHang($giao); $donhang->ThemDonHang(); if ($donhang->ThemDonHang() == FALSE) { echo "<div align='center' style='margin:10px;'><font size='+1' color='#FF0033'>Không Tạo Được Phiếu Mua. Có Lỗi Xảy Ra !</font></div>"; } else { foreach ($_SESSION['cart'] as $idHang => $SoLuong) { $chitietdonhang->set_idDonHang($idDonHang);