Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 25

Bài thảo luận

Thiết kế và triển khai website


Họ tên: Vũ Thị Thu Loan
Mã sinh viên: 19D190032
Lớp học phần: H2103ECIT0731
File: trangchu.php
<!DOCTYPE html>
<html>
<title>HOME</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="https://www.w3schools.com/lib/w3.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Amatic+SC">
<style>
body,h1,h2,h3,h4,h5,h6 {font-family: "Amatic SC", sans-serif}
body {
  background-image: url("anh/view.png");
  float: left;
  background-repeat: no-repeat;
}
</style>

<body>
<!-- Start Content -->
<div id="home" class="w3-content">

<!-- Navbar (Sits on top) -->
<div class="w3-top w3-bar w3-xlarge w3-black w3-opacity-min w3-right">
<a href="trangchu.php" button onclick ="document.location='Trangchu.php'" class=
"w3-bar-item w3-button">HOME</a>
<a href = "thucdon.php" button onclick ="document.location='thucdon.php'" class=
"w3-bar-item w3-button" >MENU</a>
<a href ="time.php" button onclick ="document.location='time.php'" class="w3-
bar-item w3-button">ABOUT</a>
<a href="contact.php" button onclick ="document.location='contact.php'" class="w
3-bar-item w3-button">CONTACT</a>
<a href="giasanpham.php" button onclick ="document.location='giasanpham'" class=
"w3-bar-item w3-button">PRICE</a>
</div>

<!-- Header image -->

<div class="w3-display-bottomleft">
<span class="w3-tag w3-xxlarge ">Open from 8am to 12pm</span>
</div>
<div class="w3-display-middle w3-center">
<span class="w3-text-white " style="font-size:200px">HEAVEN<br>MILK-TEA</span>
<p><a  class="w3-button w3-xxlarge w3-black " button onclick 
="document.location='thucdon.php'">Let me see the menu</a></p>
</div>

<!-- End Content -->
</div>

</body>
</html>

File: thucdon.php
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>MENU</title>
    <meta name="viewport" content="width=100%">
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
    <script src="https://www.w3schools.com/lib/w3.js"></script>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?
family=Amatic+SC">
    <style>
    body,h1,h2,h3,h4,h5,h6 {font-family: "Amatic SC", sans-serif};
    div{
        width: 1500px;
    }
    </style>
</head>
<body>
    <!-- Start Content -->
    <div id="home" >

    <!-- Navbar (Sits on top) -->
    <div class="w3-top w3-bar w3-xlarge w3-black w3-opacity-min w3-right">
    <a href="trangchu.php" button onclick ="document.location='trangchu.php'" cl
ass="w3-bar-item w3-button">HOME</a>
    <a href = "thucdon.php" button onclick ="document.location='thucdon.php'" cl
ass="w3-bar-item w3-button" >MENU</a>
    <a href ="time.php" button onclick ="document.location='time.php'" class="w3
-bar-item w3-button">ABOUT</a>
    <a href="contact.php" button onclick ="document.location='contact.php'" clas
s="w3-bar-item w3-button">CONTACT</a>
    <a href="giasanpham.php" button onclick ="document.location='giasanpham'" cl
ass="w3-bar-item w3-button">PRICE</a>
    </div>
    <!-- Menu -->
    <div id="menu" class="w3-container w3-black w3-xxlarge w3-padding-64" width 
= "2000px" >
    <h1 class="w3-center w3-jumbo w3-padding-32" >THE MENU</h1>
    <div class="w3-row w3-center w3-border w3-border-dark-grey">
    <a href="#tra sua"><div class="w3-third w3-padding-large w3-red">Trà sữa</
div></a>
    <a href="#sua chua"><div class="w3-third w3-padding-large w3-hover-red">Sữa 
chua</div></a>
    <a href="#tra"><div class="w3-third w3-padding-large w3-hover-red">Trà</
div></a>
    </div>

    <div id="tra sua" class="w3-container w3-white w3-padding-32">
    <div>
    <img src="anh/tiger-sugar.png" width = "200x" height = "auto" style = "float
: left ;" ><hr>
    <h1><b>Tiger - Sugar</b><span class="w3-tag w3-red w3-round">Hot!</span>
    <span class="w3-right w3-tag w3-dark-grey w3-round ">52,000 <u>đ</u></
span></h1>
    <p class="w3-text-grey">Xếp hàng chờ em đã lâu, chờ ly trà sữa, chờ câu ân t
ình</p>
    </div>
    
    <div>
    <img src="anh/olongtranchaubabykemcafe.png" width = "200x" height = "auto" s
tyle = "float: left ;" ><hr>
    <h1><b>Ô Long Trân Châu Baby Kem Cafe</b> <span class="w3-right w3-tag w3-
dark-grey w3-round">49,000<u>đ</u></span></h1>
    <p class="w3-text-grey">Tình yêu của em không cần quà cáp sa hoa chỉ cần anh 
mua trà sữa cho em hàng ngày.</p>
    </div>

    <div>
    <img src="anh/song-long-bach-ngoc.png" width = "200x" height = "auto" style 
= "float: left ;" ><hr>
    <h1><b>Song Long Bạch Ngọc</b> <span class="w3-right w3-tag w3-dark-grey w3-
round">48,000<u>đ</u></span></h1>
    <p class="w3-text-grey">Thèm trà sữa hơn người yêu, cần trà sữa hơn cần ngườ
i yêu.</p>
    </div>
    <hr>

    <div>
    <img src="anh/olongthaicuc.png" width = "200x" height = "auto" style = "floa
t: left ;" ><hr>
    <h1><b>Ô Long Thái Cực</b> <span class="w3-right w3-tag w3-dark-grey w3-
round">45,000<u>đ</u></span></h1>
    <p class="w3-text-grey"> Thanh xuân như một chén trà, dù đậm hay nhạt miễn l
à có anh.</p>
    </div>
    <hr>

    <div>
    <img src="anh/trasuatranchauhoanggia.png" width = "200x" height = "auto" sty
le = "float: left ;" ><hr>
    <h1><b>Trà Sữa Trân Châu Hoàng Gia</b><span class="w3-tag w3-red w3-
round">Hot!</span>
    <span class="w3-right w3-tag w3-dark-grey w3-round">49,000<u>đ</u></span></
h1>
    <p class="w3-text-grey">50% trên cơ thể con gái là mỡ và còn lại là trà sữa
.</p>
    </div>
    <hr>

    <div>
    <img src="anh/trasuapanda.png" width = "200x" height = "auto" style = "float
: left ;" ><hr>
    <h1><b>Trà Sữa Panda</b> <span class="w3-right w3-tag w3-dark-grey w3-
round">25,000<u>đ</u></span></h1>
    <p class="w3-text-grey"> Ăn miếng bánh, uống miếng trà cầm tay và muốn là nh
à của nhau.</p>
    </div>
    <hr>

    <div>
    <img src="anh/trasuahanphuc.png" width = "200x" height = "auto" style = "flo
at: left ;" ><hr>
    <h1><b>Trà sữa hạnh phúc</b> <span class="w3-tag w3-red w3-round">Hot!</
span>
    <span class="w3-right w3-tag w3-dark-grey w3-round">25,000<u>đ</u></span></
h1>
    <p class="w3-text-grey">Trà sữa phải có trân châu, thanh xuân đừng có sống l
âu một mình.</p>
    </div>
    <hr>

    <div>
    <img src="anh/trasuamatcha.png" width = "200x" height = "auto" style = "floa
t: left ;" ><hr>
    <h1><b>Trà Sữa Matcha</b> <span class="w3-right w3-tag w3-dark-grey w3-
round">25,000<u>đ</u></span></h1>
    <p class="w3-text-grey">Ngẩng đầu nhìn trăng sáng, cúi đầu ngắm trân châu
.</p>
    </div>
    <hr>

    <div>
    <img src="anh/trasuasocola.png" width = "200x" height = "auto" style = "floa
t: left ;" ><hr>
    <h1><b>Trà sữa Socola</b> <span class="w3-right w3-tag w3-dark-grey w3-
round">25,000<u>đ</u></span></h1>
    <p class="w3-text-grey"> Mọi người ai cũng thích trà sữa, riêng em thích trà 
trộn vào tim anh.</p>
    </div>
    <hr>
    
    <div>
    <img src="anh/trasuabacha.png" width = "200x" height = "auto" style = "float
: left ;" ><hr>
    <h1><b>Trà Sữa Bạc Hà</b> <span class="w3-right w3-tag w3-dark-grey w3-
round">25,000<u>đ</u></span></h1>
    <p class="w3-text-grey">Cả nguồn sống thu bé lại vừa bằng những hạt trân châ
u trong ly trà sữa.</p>
    </div>
    <hr>

    <div>
    <img src="anh/traxanhsuavinhai.png" width = "200x" height = "auto" style = "
float: left ;" ><hr>
    <h1>Trà Xanh Sữa Vị Nhài<b></b> <span class="w3-right w3-tag w3-dark-grey w3
-round">39,000<u>đ</u></span></h1>
    <p class="w3-text-grey">Trà sữa phải có trân châu. Đi đâu cũng phải diễn sâu 
chụp hình. </p>
    </div>
    <hr>
    </div>

    <h1 id="sua chua" class="w3-center w3-jumbo w3-padding-32">SỮA CHUA</h1>
    <div class="w3-container w3-white w3-padding-32">
    <div>
    <img src="anh/sua-chua-trang.png" width = "200x" height = "auto" style = "fl
oat: left ;" ><hr>
    <h1><b>Sũa Chua Trắng</b> <span class="w3-tag w3-grey w3-round">Popular</
span>
    <span class="w3-right w3-tag w3-dark-grey w3-round">32,000<u>đ</u></span></
h1>
    <p class="w3-text-grey">Cứ ăn đi cho đời nó khỏe. Rồi lúc béo tha hồ tăng câ
n.</p>
    </div>
    <hr>

    <div>
    <img src="anh/sua-chua-thanh-long-hat-de.png" width = "200x" height = "auto" 
style = "float: left ;" ><hr>
    <h1><b>Sữa Chua Thanh Long Hạt Dẻ</b> <span class="w3-right w3-tag w3-dark-
grey w3-round">42,000<u>đ</u></span></h1>
    <p class="w3-text-grey">Bi kịch của đời người là đam mê đặc biệt với ẩm thực 
nhưng lại tích cực giảm cân.</p>
    </div>
    <hr>

    <div>
    <img src="anh/sua-chua-dau-tam-hoang-kim.png" width = "200x" height = "auto" 
style = "float: left ;" ><hr>
    <h1><b>Sữa Chua Dâu Tằm Hoàng Kim</b><span class="w3-tag w3-red w3-
round">Hot!</span>
    <span class="w3-right w3-tag w3-dark-grey w3-round">49,000<u>đ</u></span></
h1>
    <p class="w3-text-grey">Yêu thương có thể lấp đầy hết tất cả chỉ trừ… bao tử
.</p>
    </div>
    </div>

    <h1 id="tra" class="w3-center w3-jumbo w3-padding-32">TRÀ</h1>
    <div class="w3-container w3-white w3-padding-32">
    <div>
    <img src="anh/tra-dua.png" width = "200x" height = "auto" style = "float: le
ft ;" ><hr>
    <h1><b>Trà Dứa</b> <span class="w3-tag w3-grey w3-round">Seasonal</span>
    <span class="w3-right w3-tag w3-dark-grey w3-round">39,000<u>đ</u></span></
h1>
    <p class="w3-text-grey">Mỗi sớm một cốc trà. Niềm vui đến chật nhà</p>
    </div>
    <hr>
    <div>
    <img src="anh/hongtrabuoimatong.png" width = "200x" height = "auto" style = 
"float: left ;" ><hr>
    <h1><b>Hồng trà Bưởi Mật Ong</b> <span class="w3-right w3-tag w3-dark-grey w
3-round">42,000<u>đ</u></span></h1>
    <p class="w3-text-grey">Thanh xuân như một chén trà, dù đậm hay nhạt miễn là 
có anh.</p>
    <hr>
    </div>

    <div>
    <img src="anh/tra_xanh_chanh_leo.png" width = "200x" height = "auto" style = 
"float: left ;" ><hr>
    <h1><b>Trà Xanh Chanh Leo</b> <span class="w3-right w3-tag w3-dark-grey w3-
round">33,000<u>đ</u></span></h1>
    <p class="w3-text-grey">Ngày tháng đẹp trôi qua nhanh, hẹn nhau một chén trà 
chiều đi anh.</p>
    </div>
    </div>
    </div>

    <!-- End Content -->
    </div>
</body>
</html>

File: time.php
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Thời gian</title>
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
        <script src="https://www.w3schools.com/lib/w3.js"></script>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?
family=Amatic+SC">
        <style>
        body,h1,h2,h3,h4,h5,h6 {font-family: "Amatic SC", sans-serif}
        </style>
    </head>

    <body>
        <!-- Start Content -->
        <div id="home" >

    <!-- Navbar (Sits on top) -->
    <div class="w3-top w3-bar w3-xlarge w3-black w3-opacity-min w3-right">
    <a href="trangchu.php" button onclick ="document.location='trangchu.php'" cl
ass="w3-bar-item w3-button">HOME</a>
    <a href = "thucdon.php" button onclick ="document.location='thucdon.php'" cl
ass="w3-bar-item w3-button" >MENU</a>
    <a href ="time.php" button onclick ="document.location='time.php'" class="w3
-bar-item w3-button">ABOUT</a>
    <a href="contact.php" button onclick ="document.location='contact.php'" clas
s="w3-bar-item w3-button">CONTACT</a>
    <a href="giasanpham.php" button onclick ="document.location='giasanpham'" cl
ass="w3-bar-item w3-button">PRICE</a>
    </div>

        <!-- About -->
        <div id="about" class="w3-container w3-pale-blue w3-xlarge w3-padding-
64">
        <h1 class="w3-center w3-jumbo"><b>Góc hò hẹn</b></h1>
        <p class="w3-center w3-xxlarge ">Rũ bỏ những mệt nhọc ngày bận rộn, chún
g ta có hẹn với nhau bên ly trà sữa, tâm sự mọi muộn phiền cuộc sống, giải tỏa n
hững lo âu trong lòng !!!</p>
        <div class="w3-row-padding w3-margin-top">
        <div class="w3-third">
            <div class="w3-card">
            <img src="anh/quancafe.png" style="width:100%">
            <div class="w3-container">
                <h5 class= "w3-xlarge">góc hẹn hò</h5>
            </div>
            </div>
        </div>

        <div class="w3-third">
            <div class="w3-card">
            <img src="anh/banner.png" style="width:100%">
            <div class="w3-container">
                <h5 class= "w3-xlarge">milktea</h5>
            </div>
            </div>
        </div>

        <div class="w3-third">
            <div class="w3-card">
            <img src="anh/viewchieu.png" style="width:100%">
            <div class="w3-container">
                <h5 class= "w3-xlarge">không gian đô thị</h5>
            </div>
            </div>
        </div>
        </div>

        <div class="w3-row-padding w3-margin-top">
        <div class="w3-third">
            <div class="w3-card">
            <img src="anh/tra-sua.png" style="width:100%">
            <div class="w3-container">
                <h5 class= "w3-xlarge">không gian riêng tư</h5>
            </div>
            </div>
        </div>
        <div class="w3-third">
            <div class="w3-card">
            <img src="anh/view.png" style="width:100%">
            <div class="w3-container">
                <h5 class= "w3-xlarge">milktea</h5>
            </div>
            </div>
        </div>
        
        <div class="w3-third">
            <div class="w3-card">
            <img src="anh/background1.png" style="width:100%">
            <div class="w3-container">
                <h5 class= "w3-xlarge">không gian chill</h5>
            </div>
            </div>
        </div>
        </div>

        <h1><b>Thời Gian Hoạt Động</b></h1>
        <div class="w3-row ">
        <div class="w3-half">
        <p class= "w3-xlarge">Monday CLOSED</p>
        <p class= "w3-xlarge">Tuesday 8.00 - 23.00</p>
        <p class= "w3-xlarge">Wednesday 8.00 - 23.00</p>
        <p class= "w3-xlarge">Thursday 8:00 - 23:00</p>
        </div>
        <div class="w3-half">
        <p class= "w3-xlarge">Friday 8:00 - 23:00</p>
        <p class= "w3-xlarge">Saturday 8:00 - 23:00</p>
        <p class= "w3-xlarge">Sunday 8.00 - 18.00</p>
        </div>
        </div>    
        </div>
        <!-- End Content -->
        </div>
    </body>
</html>

File: giasanpham.php
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Giá Sản Phẩm</title>
    <meta charset="UTF-8">
    <meta name="viewport" >
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
    <script src="https://www.w3schools.com/lib/w3.js"></script>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?
family=Amatic+SC">
    <style>
    body,h1,h2,h3,h4,h5,h6 {font-family: "Amatic SC", sans-serif}
    </style>
</head>
<body>
    <div class="w3-top w3-bar w3-xlarge w3-black w3-opacity-min w3-right">
    <a href="trangchu.php" button onclick ="document.location='Trangchu.php'" cl
ass="w3-bar-item w3-button">HOME</a>
    <a href = "thucdon.php" button onclick ="document.location='thucdon.php'" cl
ass="w3-bar-item w3-button" >MENU</a>
    <a href ="time.php" button onclick ="document.location='time.php'" class="w3
-bar-item w3-button">ABOUT</a>
    <a href="contact.php" button onclick ="document.location='contact.php'" clas
s="w3-bar-item w3-button">CONTACT</a>
    <a href="giasanpham.php" button onclick ="document.location='giasanpham'" cl
ass="w3-bar-item w3-button">PRICE</a>
    </div>
<?php
    // Kết nối đến cơ sở dữ liệu
    $kn = mysqli_connect("localhost", "admin", "1234567", "csdl");
    // Truy vấn dữ liệu
    if(isset($_GET["search"]) && !empty($_GET["search"])) {
        $tukhoa = $_GET["search"];
        $sql = "SELECT * FROM danhmucsanpham WHERE stt LIKE '%$tukhoa%' OR tensa
npham LIKE '%$tukhoa%' OR gia LIKE '%$tukhoa%'";
    }
    else {
        $sql = "SELECT * FROM danhmucsanpham";
    }
    $ketqua = mysqli_query($kn, $sql);
    ?>
    <br><br><br>
    <!-- Tiêu đề bảng -->
    <h1  class="w3-container w3-center"><b>SẢN PHẨM</b></h1>
    <!-- Bảng tìm kiếm dữ liệu -->
    <table align="center" cellpadding="5" class="search-form">
        <tr>
            <td>
                <form action="" method="GET">
                    <input type="text" class="w3-button w3-white w3-border w3-
xlarge "  name="search" placeholder="Nhập từ khóa cần tìm" value="<?php i
f(isset($_GET["search"])) { echo $_GET["search"]; } ?>">
                    <input type="submit" class="w3-button w3-black w3-xlarge"  v
alue="Tìm kiếm">
                    <input type="button" class="w3-button w3-black w3-xlarge" va
lue="Hiển thị tất cả" onclick="window.location.href='giasanpham.php'">
                </form>
            </td>
        </tr>
    </table>
    <!-- Bảng chứa dữ liệu -->
    <table border="2" width="100%" cellpadding="3" >  
        <tr>
            <th class="w3-container w3-center w3-xlarge">Số thứ tự </th>
            <th class="w3-container w3-center w3-xlarge">Tên sản phẩm</th>
            <th class="w3-container w3-center w3-xlarge">Giá</th>
            <th class="w3-container w3-center w3-xlarge" colspan="2">Chức năn
g</th>
        </tr>
        <?php
        // Hiển thị danh sách dữ liệu
        while($row = mysqli_fetch_assoc($ketqua)) {
            $stt = $row["stt"];
            $tensanpham = $row["tensanpham"];
            $gia = $row["gia"];
        ?>
        <tr>
            <td class="w3-container w3-center w3-xlarge"><?php echo $stt; ?></
td>
            <td class="w3-container w3-center w3-xlarge"><?php echo $tensanpham; 
?></td>
            <td class="w3-container w3-center w3-xlarge"><?php echo $gia; ?
><u>đ</u></td>
            <td class="w3-container w3-center w3-xlarge"><a href="suadulieu.php?
stt=<?php echo $stt; ?>">Sửa</a></td>
            <td class="w3-container w3-center w3-xlarge"><a href="xoadulieu.php?
stt=<?php echo $stt; ?>">Xóa</a></td>
        </tr>
        <?php
        }
        // Đóng kết nối cơ sở dữ liệu
        mysqli_close($kn);
        ?>
        <!-- Tạo nút thêm -->
        <tr>
            <td colspan="7" align="center">
                <input type="button" class="w3-button w3-black" onclic
k="insert()" value="Thêm">
            </td>
        </tr>   
    </table>
    <script>
        // Chuyển tới trang thêm dữ liệu
        function insert() {
            location.replace("themdulieu.php");
        }
    </script>
</body>
</html>
File: contact.php
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Liên hệ</title>
        <meta name="viewport" content="width=device-width,initial-scale=1">
        <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
        <script src="https://www.w3schools.com/lib/w3.js"></script>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?
family=Amatic+SC">
        <style>
        body,h1,h2,h3,h4,h5,h6 {font-family: "Amatic SC", sans-serif};
        body{
            float: left;
        }
        </style>
    </head>
    <body>
        <?php 
        $kn = mysqli_connect("localhost", "admin", "1234567", "csdl")or die("Khô
ng thể kết nối đến cơ sở dữ liệu");
        $ketqua = mysqli_query($kn, "SELECT * FROM 'thongtinkhachhang'");
        mysqli_close($kn);
        ?>
        <!-- Start Content -->
        <div id="home">

        <!-- Navbar (Sits on top) -->
        <div class="w3-top w3-bar w3-xlarge w3-black w3-opacity-min w3-right">
        <a href="trangchu.php" button onclick ="document.location='trangchu.php'
" class="w3-bar-item w3-button">HOME</a>
        <a href = "thucdon.php" button onclick ="document.location='thucdon.php'
" class="w3-bar-item w3-button" >MENU</a>
        <a href ="time.php" button onclick ="document.location='time.php'" class
="w3-bar-item w3-button">ABOUT</a>
        <a href="contact.php" button onclick ="document.location='contact.php'" 
class="w3-bar-item w3-button">CONTACT</a>
        <a href="giasanpham.php" button onclick ="document.location='giasanpham'
" class="w3-bar-item w3-button">PRICE</a>
        </div>

        <!-- Contact -->
        <div>
        <img id="contact" src="anh/anhsanthuong.png" class="w3-image "  styl
e="width:100%">
        </div>
        <div class="w3-container w3-blue-grey w3-grayscale-min w3-xlarge w3-
padding-top-32">
        <h1 class="w3-center w3-jumbo">LIÊN HỆ</h1>
        <p class="w3-xxlarge">Thông tin khách hàng:</p>
        <form action="khachhang.php" target="_blank" method="POST">
        <p><input class="w3-input w3-padding-16 w3-border" type="text" placehold
er="HọTên"  name="Name"></p>
        <p><input class="w3-input w3-padding-16 w3-border" type="number" placeho
lder="Số điện thoại"  name="Phone"></p>
        <p><input class="w3-input w3-padding-16 w3-border" type="number" placeho
lder="Số lượng thành viên"  name="People"></p>
        <p><input class="w3-input w3-padding-16 w3-border" type="datetime-local" 
placeholder="ngày giờ"  name="Datetime" ></p>
        <p><input class="w3-input w3-padding-16 w3-border" type="text" placehold
er="Ghi chú" name="Note"></p>
        <p><button class="w3-button w3-light-grey w3-block" type="submit" nam
e="btn-submit">GỬI</button></p>
        </form>
        </div>
        
        <!-- End Content -->
    </div>
    </body>
</html>

File: khachhang.php
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Xác nhận</title>
        <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
        <script src="https://www.w3schools.com/lib/w3.js"></script>
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?
family=Amatic+SC">
        <style>
        body,h1,h2,h3,h4,h5,h6 {font-family: "Amatic SC", sans-serif} ;
        </style>
    </head>
    <body class= "w3-center w3-black w3-display-middle w3-xlarge">
<?php
// Create connection
$kn = mysqli_connect("localhost", "admin", "1234567", "csdl") or die("Không thể 
kết nối đến cơ sở dữ liệu");
$ketqua = mysqli_query($kn, "SELECT * FROM 'thongtinkhachhang'");

if(isset($_POST["btn-submit"])) {
  // Lưu dữ liệu vào biến
  $HoTen =$_POST["Name"];
  $SoDienThoai =$_POST["Phone"];
  $SoLuongThanhVien =$_POST["People"];
  $ThoiGian=$_POST["Datetime"];
  $GhiChu =$_POST["Note"];
$sql = "INSERT INTO thongtinkhachhang( HoTen, SoDienThoai, SoLuongThanhVien,ThoiG
ian,GhiChu ) VALUES ('$HoTen' ,'$SoDienThoai' ,'$SoLuongThanhVien' ,'$ThoiGian',
'$GhiChu')";

// Check connection
if(mysqli_query($kn, $sql)) {
  echo "<h1>xác nhận thông tin khách hàng thành công!</h1><br>";
  echo "Họ Tên : $HoTen<br><br>";
  echo "Số Điện Thoại: $SoDienThoai<br><br>";
  echo "Số Lượng Thành Viên : $SoLuongThanhVien<br><br>";
  echo "Thời Gian Đặt : $ThoiGian<br><br>";
  echo "Ghi Chú : $GhiChu<br><br>";
}
else {
  $ketqua = "Không thêm được dữ liệu!". mysqli_error($kn);
}
}
?>
    </body>
</html>

File: suadulieu.php
<!doctype html>
<html lang="vi">
<head>
    <meta charset="utf-8">
    <title>Sửa dữ liệu</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
    <script src="https://www.w3schools.com/lib/w3.js"></script>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?
family=Amatic+SC">
    <style>
    body,h1,h2,h3,h4,h5,h6 {font-family: "Amatic SC", sans-serif};
    .color { color: dardred; text-decoration: underline; }
    </style>
</head>
<body>
    <!-- Navbar (Sits on top) -->
    <div class="w3-top w3-bar w3-xlarge w3-black w3-opacity-min w3-right">
    <a href="trangchu" button onclick ="document.location='trangchu.php'" class=
"w3-bar-item w3-button">HOME</a>
    <a href = "thucdon.php" button onclick ="document.location='thucdon.php'" cl
ass="w3-bar-item w3-button" >MENU</a>
    <a href ="time.php" button onclick ="document.location='time.php'" class="w3
-bar-item w3-button">ABOUT</a>
    <a href="contact.php" button onclick ="document.location='contact.php'" clas
s="w3-bar-item w3-button">CONTACT</a>
    <a href="giasanpham.php" button onclick ="document.location='giasanpham'" cl
ass="w3-bar-item w3-button">PRICE</a>
    </div>
    <?php
    // Kết nối đến cơ sở dữ liệu
    $kn = mysqli_connect("localhost", "admin", "1234567", "csdl");
    $stt = $_GET["stt"];
    $sql = "SELECT * FROM danhmucsanpham WHERE stt='$stt'";
    $ketqua = mysqli_query($kn, $sql);
    // Hiển thị danh sách dữ liệu
    while($row = mysqli_fetch_assoc($ketqua)) {
        $stt = $row["stt"];
        $tensanpham = $row["tensanpham"];
        $gia = $row["gia"];
    }
    ?>
    <!-- Form sửa dữ liệu -->
    <br><br>
    <center>
    <br><br><br><br><br><br>
    <h3 class=" w3-xxlarge "><b> Sửa dữ liệu </b></h3>
    <form action="xulysuadulieu.php" method="POST"  class = "w3-center w3-
display-middle">
    <table>
        <tr>
            <td class=" w3-xlarge">Số thứ tự:</td>
            <td><input type="text" class="w3-button w3-black w3-xlarge" nam
e="stt" value="<?php echo $stt?>"/></td>
        </tr>
        <tr>
            <td class=" w3-xlarge">Tên sản phẩm:</td>
            <td><input type="text" class="w3-button w3-black w3-xlarge" nam
e="tensanpham" value="<?php echo $tensanpham?>"/></td>
        </tr>
        <tr>
            <td class=" w3-xlarge">Giá:</td>
            <td><input type="text" class="w3-button w3-black w3-xlarge" nam
e="gia" value="<?php echo $gia?>"/></td>
        </tr>
        <tr>
            <td><input type="submit" class="w3-button w3-black w3-xlarge" valu
e="Sửa" name="edit"></td>
        </tr>
        </table>
    </form>
    </center>
</body>
</html>

File: xulysuadulieu.php
<?php
// Kết nối đến cơ sở dữ liệu
$kn = mysqli_connect("localhost", "admin", "1234567", "csdl");
// Kiểm tra dữ liệu
if(isset($_POST["edit"])) {
    // Lưu dữ liệu vào biến
    $stt = $_POST["stt"];
    $tensanpham = $_POST["tensanpham"];
    $gia = $_POST["gia"];
}
// Truy vấn dữ liệu
$sql = "UPDATE baiviet SET stt = '$stt', tensanpham = '$tensanpham', gia = '$gia
'";
// Nếu sửa dữ liệu thành công thì hiển thị kết quả trên bảng
if(mysqli_query($kn, $sql)) {
    header('location: giasanpham.php');
}
else {
    $ketqua = "Không sửa được dữ liệu!" . mysqli_error($kn);
}
?>

File: themdulieu.php
<!doctype html>
<html lang="vi">
<head>
    <title>Thêm dữ liệu</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
    <script src="https://www.w3schools.com/lib/w3.js"></script>
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?
family=Amatic+SC">
    <!-- Tạo kiểu cho tiêu đề -->
   <style>
    body,h1,h2,h3,h4,h5,h6 {font-family: "Amatic SC", sans-serif};
    </style>
</head>
<body>
    <!-- Navbar (Sits on top) -->
    <div class="w3-top w3-bar w3-xlarge w3-black w3-opacity-min w3-right">
    <a href="trangchu.php" button onclick ="document.location='Trangchu.php'"  c
lass="w3-bar-item w3-button">HOME</a>
    <a href = "thucdon.php" button onclick ="document.location='thucdon.php'" cl
ass="w3-bar-item w3-button" >MENU</a>
    <a href ="time.php" button onclick ="document.location='time.php'" class="w3
-bar-item w3-button">ABOUT</a>
    <a href="contact.php" button onclick ="document.location='contact.php'" clas
s="w3-bar-item w3-button">CONTACT</a>
    <a href="giasanpham.php" button onclick ="document.location='giasanpham'" cl
ass="w3-bar-item w3-button">PRICE</a>
    </div>
    <br><br><br><br><br><br><br><br>
    <!-- Form thêm dữ liệu -->
    <h3  class="w3-xxlarge w3-center"> <b> Thêm dữ liệu </b></h3>
    <form  action="xulythemdulieu.php" method="POST" class = "w3-center w3-
display-middle" >
    <table>
        <tr>
            <td class=" w3-xlarge">Số thứ tự:</td>
            <td><input type="text" class="w3-button w3-black w3-xlarge" nam
e="stt" placeholder="123" value="<?php echo $stt = "";?>"></td>
        </tr>
        <tr>
            <td class=" w3-xlarge">Tên sản phẩm:</td>
            <td><input type="text" class="w3-button w3-black w3-xlarge" nam
e="tensanpham" placeholder="Trà Sữa, Trà Chanh,..." value="<?php echo $tensanpha
m = "";?>"></td>
        </tr>
        <tr>
            <td class="w3-xlarge">Giá:</td>
            <td><input type="text" name="gia" class="w3-button w3-black w3-
xlarge" placeholder="39000" value="<?php echo $gia = "";?>"></td>
        </tr>
        <tr>
            <td><input type="submit" class="w3-button w3-black w3-xlarge" valu
e="Thêm" name="insert"></td>
        </tr>
    </table>
</form>
</body>
</html>

File: xulythemdulieu.php
<?php
// Kết nối đến cơ sở dữ liệu
$kn = mysqli_connect("localhost", "admin", "1234567", "csdl");
// Kiểm tra dữ liệu
if(isset($_POST["edit"])) {
    // Lưu dữ liệu vào biến
    $stt = $_POST["stt"];
    $tensanpham = $_POST["tensanpham"];
    $gia = $_POST["gia"];
}
// Truy vấn dữ liệu
$sql = "UPDATE baiviet SET stt = '$stt', tensanpham = '$tensanpham', gia = '$gia
'";
// Nếu sửa dữ liệu thành công thì hiển thị kết quả trên bảng
if(mysqli_query($kn, $sql)) {
    header('location: giasanpham.php');
}
else {
    $ketqua = "Không sửa được dữ liệu!" . mysqli_error($kn);
}
?>

File: xoadulieu.php
<?php
// Kết nối đến cơ sở dữ liệu
$kn = mysqli_connect("localhost", "admin", "1234567", "csdl");
$stt = $_GET["stt"];
// Câu lệnh SQL DELETE
$sql = "DELETE FROM danhmucsanpham WHERE stt = '$stt' ";
// Nếu xóa dữ liệu thành công thì hiển thị kết quả trên bảng
if(mysqli_query($kn, $sql)) {
    header('location: giasanpham.php');
}
else {
    $ketqua = "Không xóa được dữ liệu!" . mysqli_error($kn);
}
// Đóng kết nối cơ sở dữ liệu
mysqli_close($kn);
?>

You might also like