You are on page 1of 37

BÀI THẢO LUẬN

Thiết kế Website bằng CSS, HTML, JAVASCRIPT, PHP.


Họ và tên: Nguyễn Thị Huệ
Mã SV: 18D190139
Số thứ tự: 39
Mã LHP: 2113ECIT0731

I. GIAO DIỆN WEBSITE


- Trang Đăng nhập

- Trang chủ
- Trang Địa điểm
- Trang Đặc sản
- Trang Bảng giá
- Trang Đăng ký nhận tư vấn
II. CƠ SỞ DỮ LIỆU
III. CODE
 CSS
*{
    padding: 0px;
    margin: 0px;
    font-family: Arial, Helvetica, sans-serif;
  }
  a{
    text-decoration: none;
  }

  li{
    list-style-type: none;
  }
.text-while{
   color: #fff !important;
}
/* Header */
#header {
  width: 100%;
  height: 120px;
  background: #fff;
  text-align: center;
  background-image: url('../assets/image/head.jpg');

}
.heading-text{
  font-size: 40px;
  text-transform: uppercase;
  padding-top: 20px;
  color: #CE3535;
  letter-spacing: 3px;
  text-shadow: 2px 1px #000;
  font-weight: 700;
}
#header .text{
  font-size: 14px;
  font-style: italic;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: px 1px #000;
}
.search-icon{
  color: #fff;
}

/* Menu */
#menu{
  height: 46px;
  background-color: #4B0082;
}
#nav{
  display: inline-block;
}
#nav li{
  display: inline-block;
  position: relative;
}
 #nav li a{
    color: white;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 46px;
    padding: 0 24px;
    display: block;
  }

#nav li:hover a{
  color: black;
  background-color: #ccc;
}
#menu .search-btn{
  float: right;
  padding: 0 21px;
}
#menu .search-btn:hover{
  background-color: #f44336;
  cursor:pointer;
}
#menu .search-icon{
  color: #fff;
  font-size: 20px;
  line-height: 46px;
}
/* main */
#main{
  min-height: 1350px;
  width: 100%;
  background: #FFFFE0;
  margin-top: 30px;
  display: flex;
  justify-content: space-between;
}

/* Main content */
.main-content{
  border: 1px ;
  height: 1000px;
  width: 70%;
  margin: 0px;
  padding: 0px;
}
.main-content .section-heading{
  font-size: 30px;
  text-align: center;
  font-weight: 500;
  letter-spacing: 4px;
  padding: 20px 0px;
}
.about-text{
  padding: 0px 20px;
  font-size: 15px;
  text-align: justify;
  line-height: 1.4;
}
.main-content .content-png{
  width: 95%;  
  padding-bottom: 30px;
}
.content-link{
  padding-top: 10px;
  display: block;
  padding-left: 20px;
}

/* Footer */

#footer {
  background:#4B0082;
  height: 70px;
  width: 100%;
}
#footer .text{
  color: #fff;
  text-align: center;
  line-height: 20px;
  padding: 18px 0px;
  box-sizing: border-box;

/* Place */
.place-section{
  background-color: #FFFFE0;
  }
.place-section .section-heading{
  font-size: 30px;
  text-align: center;
  font-weight: 500;
  letter-spacing: 4px;
  padding: 20px 0px 10px;
}
.place-section .section-sub-heading{
  text-align: center;
  font-size: 16px;
  font-style: italic;
  opacity: 0.6;
  padding: 5px 0px;
}
.place-list{
  margin-top: 16px;
  width: 900px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin: 0 auto;
}
.place-list .item{
  width: 250px;
  min-height: 400px;
  margin-right: 21px;
  margin-bottom: 40px;
  background-color: rgb(241, 209, 209);
transition: 1s ease-in;
-moz-transition: 1s ease-in;
-webkit-transition: 1s ease-in;
position: relative;
}
.item .section-heading{
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 4px;
  padding: 20px 0px;
}

.item .place-img{
  width: 100%;
  height: 185px;
}

/* Specialties */

.food-section{
  background-color: #FFFFE0;
}
  .food-section .section-heading{
    font-size: 30px;
    text-align: center;
    font-weight: 500;
    letter-spacing: 4px;
    padding: 20px 0px 10px;
  }
  .food-section .section-sub-heading{
    text-align: center;
    font-size: 16px;
    font-style: italic;
    opacity: 0.6;
    padding: 10px 0px 20px;
  }
.food-list{

  width: 900px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin: 0 auto;

}
.food-list .item{
  width: 400px;
  min-height: 400px;
  margin-right: 21px;
  margin-bottom: 40px;
  background-color: rgb(241, 209, 209);
transition: 1s ease-in;
-moz-transition: 1s ease-in;
-webkit-transition: 1s ease-in;
position: relative;

}
.item .food-img{
  width: 100%;
  height: 250px;
}
.food-section .item .section-heading{
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 4px;
  padding: 20px 0px;
}

/* Price */
.price-section{
  background-color: #FFFFE0;
  padding-top: 10px;
  }
  .price-section .section-heading{
    font-size: 30px;
    text-align: center;
    font-weight: 500;
    letter-spacing: 4px;
    padding: 20px 0px 10px;
  }
  .price-section .section-sub-heading{
    text-align: center;
    font-size: 16px;
    font-style: italic;
    opacity: 0.6;
    padding: 10px 0px 20px;
  }
.price-list{
  margin-top: 16px;
  overflow: auto;
  width: 100%;
  margin: 10px 10px 100px 100px;
}
.row a {
   color:navy;
   font-size: large;
   padding-left: 2px;
}
table, th, td {
   border: 1px solid black;
}
table {
   border-collapse: collapse;
}
.form-control{
    height: 30px;
    width: 250px;
}
.btn-default{
  border: none;
  border-radius: 4px;
  padding: 10px;
  cursor: pointer;
}

/* Advisory */
.form {
    padding-left: 20px;
    background: mistyrose;
    padding-top: 5px;
}
.form .section-heading{
  font-size: 30px;
    text-align: center;
    font-weight: 500;
    letter-spacing: 4px;
    padding: 20px 0px 10px;
}
.content-png {
    display: flex;
    padding-top:20px;
    margin-left:auto;
    margin-right:auto;
}

/* Edit */
.btn{
  margin: 20px 0;
}
.form {
  width: 40%;
  margin: auto;
  border-radius: 5px;
  background-color: #e2dfdf;
  padding: 20px;
}
  input[type=text] {
      width: 100%;
      padding: 12px;
      border: 1px solid #ccc;
      border-radius: 4px;
      box-sizing: border-box;
      margin: 15px 0px;
  }

  .btn-primary {
      background-color: #4CAF50;
      color: white;
      padding: 12px 20px;
      border: none;
      border-radius: 4px;
      cursor: pointer;
  }

.btn-primary:hover {
  background-color: #5ac05f;
}

---LOGIN---
<?php  
    session_start();
    include_once 'config/myConnect.php';
?>

<!DOCTYPE html>
<html lang="">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Hưng Yên</title>
</head>
    <body>

        <div class="container">
            
            <div class="row" style="margin-top: 150px;">
                <div class="col-md-6 col-md-push-3">
                    
                    <?php  
                        if (isset($_GET['page'])) {
                            $page = $_GET['page'];
                        }else{
                            $page = 'login';
                        }

                        switch ($page) {
                            case 'login':
                                include_once 'login.php';
                                break;
                            
                            default:
                                echo "<h2 style='color: red;'>ERROR 404, trang k
hông tồn tại</h2><a href='index.php'>Quay lại</a>";
                                break;
                        }

                    ?>

                </div>
            </div>

        </div>
    </body>
</html>

<?php  
    if (isset($_POST['login'])) {
        $email = mysqli_real_escape_string($conn, $_POST['user']);
        $password = mysqli_real_escape_string($conn, $_POST['password']);
        
        $sql = "SELECT *FROM users WHERE email = '$email' AND password = '$passw
ord'";
        $query = mysqli_query($conn, $sql);
        $nums = mysqli_num_rows($query);
        
        if ($nums == 1) {

            header('location: admin/index.php');
        }else{
            $errors = 'Tài khoản hoặc mật khẩu không đúng!';
        }

    } 

?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Paper Stack</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="container">
    <section id="content">
        <form action="" method="post">
            <h1>Login Form</h1>
            <div>
                <input type="text" placeholder="Username" required="" id="userna
me" name = "user" value="<?php if(isset($email)) { echo $email; } ?>"/>
            </div>
            <div>
                <input type="password" placeholder="Password" required="" id="pa
ssword" name="password"/>
            </div>
            <div>
                <input type="submit" value="Log in" name="login"/>
                <a href="#">Lost your password?</a>
                <a href="#">Register</a>
            </div>
            
        </form>
        <?php  
        if (isset($errors)) {
        ?>
        <div class="alert alert-danger">
            <button type="button" class="close" data-dismiss="alert" aria-
hidden="true">&times;</button>
            <strong></strong> <?php echo $errors; ?>
        </div>
    <?php
        }
    ?>
    </section>
</div>
</body>
</html>

<?php  
    // Connect database
    $conn = mysqli_connect('localhost', 'root', '', 'hungyen') or die("Can't con
nect database");

    if ($conn) {
        mysqli_set_charset($conn, 'utf8');
    }else{
        echo "Can't connect database";
        exit();
    }
?>

---Includes---
-Index-

<?php
    ob_start();
    session_start();
    include_once '../config/myConnect.php';
?>
<!DOCTYPE html>
<html>
<head>
    <?php include_once 'include/head.php'?>
</head>
<body>
<?php include_once 'include/header.php'?>
<?php include_once 'include/menu.php'?>
    <!-- menu -->
    <div id="container"> 
    <?php
        if (isset($_GET['page'])){
            $page = $_GET['page'];
        }else {
            $page = 'home';
        }
        if(file_exists('pages/'.$page.'.php')){
          include_once 'pages/'.$page.'.php';
        }
                
    ?>
    </div>
    <?php include_once 'include/footer.php'?>
</body>
</html>

-Head-
<meta charset="utf-8">
  <title> Website-Thảo luận </title>
  
  <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" typ
e="text/css">
  <link rel="stylesheet" href="assets/style.css">

<div id="header">
        <p class="heading-text">Khám phá hưng yên</p>
        <marquee >
            <pre class="text">
                  Dù ai buôn Bắc bán Đông
            Đố ai quên được nhãn lồng Hưng Yên
            </pre>
        </marquee>
    </div>

-Menu-
<div id="menu">
      <ul id="nav">
        <li><a href="index.php">TRANG CHỦ</a></il>
        <li><a href="index.php?page=place">ĐỊA ĐIỂM</a></li>
        <li><a href="index.php?page=specialties">ĐẶC SẢN</a></li>
        <li><a href="index.php?page=price">BẢNG GIÁ</a></li>
        <li><a href="index.php?page=advisory">ĐĂNG KÝ NHẬN TƯ VẤN</a></li>
      </ul>
      <div class="search-btn">
        <i class="search-icon fab fa-facebook-f"></i>
      </div>

-Footer-
<div id="footer">
      <div class="text">
        <p>Trang web được tạo bởi: Nguyễn Thị Huệ - Lớp K54S3</p>
        <p>Khoa HTTTKT và TMĐT - Đại học Thương Mại</p>
      </div>
</div>

-Notification-
<?php  
    if (isset($_SESSION['noti']) && $_SESSION['noti'] == 1) {
?>
    <div class="alert alert-success">
        <button type="button" class="close" data-dismiss="alert" aria-
hidden="true">&times;</button>
        <strong>Noti: </strong> Update success!
    </div>
<?php
    }
    unset($_SESSION['noti']);
?>

---Pages---
-Home-
<div id="main">
      <div class= "sidebar">
          <p class="text-while sidebar-text">Những địa điểm khác</p>
          <ul class="list_sidebar">
              <li><a href="#">Khám phá Hà Nam</a></li>
              <li><a href="#">Khám phá Thanh Hóa</a></li>
              <li><a href="#">Khám phá Hòa Bình</a></li>
              <li><a href="#">Khám phá Bắc Giang</a></li>
              <li><a href="#">Khám phá Lào Cai</a></li>
              <li><a href="#">Khám phá Ninh Bình</a></li>
              <li><a href="#">Khám phá Hải Dương</a></li>
              <li><a href="#">Khám phá Thái Nguyên</a></li>
          </ul>
      </div>
      <div class="main-content">
        <h2 class="section-heading">GIỚI THIỆU</h2>
        <p class="about-text">
          Hưng Yên là tỉnh thuộc vùng đồng bằng Bắc Bộ, thuộc tam giác kinh tế t
rọng điểm Hà Nội - Hải Phòng - Quảng Ninh. Hưng Yên nằm trong toạ độ 20°36' và 2
10 vĩ độ Bắc, 105°53' và 106°15' kinh độ Đông, phía bắc giáp tỉnh Bắc Ninh, phía 
đông giáp tỉnh Hải Dương, phía tây giáp thủ đô Hà Nội và tỉnh Hà Tây, Hà Nam, ph
ía nam giáp tỉnh Thái Bình.
        </p>
        <img class="content-png" src="assets/image/banner1.png">
         <p class="about-text">
                Hưng Yên là tỉnh thuộc vùng đồng bằng Bắc Bộ, thuộc tam giác kin
h tế trọng điểm Hà Nội - Hải Phòng - Quảng Ninh. Hưng Yên nằm trong toạ độ 20°36
' và 210 vĩ độ Bắc, 105°53' và 106°15' kinh độ Đông, phía bắc giáp tỉnh Bắc Ninh
, phía đông giáp tỉnh Hải Dương, phía tây giáp thủ đô Hà Nội và tỉnh Hà Tây, Hà 
Nam, phía nam giáp tỉnh Thái Bình.
            </p>
            <p class="about-text">
                Vị trí địa lý: Hưng Yên là tỉnh thuộc vùng đồng bằng Bắc Bộ, thu
ộc tam giác kinh tế trọng điểm Hà Nội - Hải Phòng - Quảng Ninh. Hưng Yên nằm tro
ng toạ độ 20°36' và 21° vĩ độ Bắc, 105°53' và 106°15' kinh độ Đông, phía bắc giá
p tỉnh Bắc Ninh, phía đông giáp tỉnh Hải Dương, phía tây giáp thủ đô Hà Nội và t
ỉnh Hà Tây, Hà Nam, phía nam giáp tỉnh Thái Bình.
            </p>
            <p class="about-text">
                Kinh tế: cùng với sự phát triển kinh tế của cả nước, Hưng Yên đư
ợc đánh giá là một trong những tỉnh có tốc độ tăng trưởng kinh tế tương đối nhan
h và cao. Nền kinh tế Hưng Yên đang đổi thay từng ngày. Cơ cấu kinh tế đang dần 
chuyển dịch theo hướng công nghiệp hoá, hiện đại hoá. Nông nghiệp, nông thôn có 
nhiều chuyển biến tích cực, tỷ trọng giữa chăn nuôi và trồng trọt được cân đối. 
Người nông dân bước đầu quan tâm đến sản xuất hàng hoá, đảm bảo an ninh lương th
ực. Công nghiệp, dịch vụ có bước phát triển khá. Công nghiệp địa phương tuy còn 
phải đối mặt với nhiều khó khăn, nhưng vẫn đạt được những thành tích đáng khích 
lệ. Một số ngành hàng tiếp tục được củng cố phát triển, lựa chọn các mặt hàng ưu 
tiên và có lợi thế để đầu tư chiều sâu, đổi mới công nghệ, tạo ra những sản phẩm 
chất lượng cao. Khối công nghiệp có vốn đầu tư nước ngoài tăng nhanh do số dự án 
đi vào hoạt động tăng lên, sản phẩm được thị trường chấp nhận và có xu thế phát 
triển tốt. Riêng ngành du lịch và dịch vụ cần phải nỗ lực nhiều hơn nữa, đáp ứng 
nhu cầu khai thác tiềm năng phục vụ khách du lịch trong và ngoài nước như: du lị
ch Phố Hiến, di tích Chử Đồng Tử - Tiên Dung.
           </p>
            <p class="about-text">
                Dân số - lao động: nguồn nhân lực Hưng Yên khá dồi dào. Dân số n
ăm 2004 là trên 1,1 triệu người, trong đó số người trong độ tuổi lao động chiếm 
hơn 50%. Tỷ lệ lao động có trình độ của Hưng Yên thấp, bởi sau khi tái lập tỉnh, 
đội ngũ cán bộ khoa học có trình độ ở lại tỉnh công tác ít. Hiện nay, số lao độn
g chưa có việc làm ổn định còn nhiều đã trở thành sức ép lớn đối với Hưng Yên tr
ong vấn đề giải quyết việc làm.
            </p>
            
             <a class="content-link" href="">Chi tiết</a>
      </div>
    </div>
    
    <div class="map">
      <iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!
1d477379.08489054!2d105.80055558201151!3d20.810532427949564!2m3!1f0!2f0!3f0!3m2!
1i1024!2i768!4f13.1!3m3!1m2!1s0x3135af35301d265d%3A0xa7a9ea16cfd6d482!
2zSMawbmcgWcOqbiwgVmnhu4d0IE5hbQ!5e0!3m2!1svi!2s!4v1618908026189!5m2!1svi!2s" wid
th="100%" height="450" style="border:0;" allowfullscreen="" loading="lazy"></
iframe>
    </div>

-Place-
<div id="place" class="place-section">
        <h2 class="section-heading">ĐỊA ĐIỂM</h2>
        <p class="section-sub-heading">Những địa điểm nổi tiếng ở Hưng Yên</p>
        <div class="place-list">
          <div class="item">
              <img src="assets/image/chu_dong_tu.jpg" class="place-img">
              <h3 class="section-heading">Đền Chử Đồng Tử </h3>
              <p class="about-text">
                Đền Chử Đồng Tử là ngôi đền nằm trong truyền thuyết văn lang từ 
đời Hùng Vương thứ 18. Đến nay, ngôi đền này là minh chứng cho đạo Phật xuất hiệ
n ở Việt Nam từ xưa. Và là điểm đến tâm linh thú vị nhất cho du khách thập phươn
g.
              </p>
              <a class="content-link" href="#">Chi tiết</a>
          </div>
          <div class="item">
            <img src="assets/image/pho_hien.jpg" class="place-img">
              <h3 class="section-heading">Phố Hiến</h3>
              <p class="about-text">
                Phố Hiến nằm sâu trong bến bãi sông Hồng, đây từng là thương cản
g sầm uất ở giai đoạn thế kỷ 13-17. Không còn vẻ nhộn nhịp như xưa, Phố Hiến nay 
đã trở thành một phố cổ, bình yên đến lạ thường.
              </p>
              <a class="content-link" href="#">Chi tiết</a>
          </div>
           <div class="item">
            <img src="assets/image/phuc_lam.jpg" class="place-img">
            <h3 class="section-heading">Chùa Phúc Lâm</h3>
            <p class="about-text">
                Chùa Phúc Lâm Hưng Yên nằm ở thôn La Mát, xã Phù Ủng, huyện Ân T
hi, tỉnh Hưng Yên. Đây là một địa điểm du lịch tâm linh hấp dẫn chỉ cách Hà Nội 
khoảng 1 tiếng chạy xe. Chùa Phúc Lâm Hưng Yên đang là một ngôi chùa được nhiều 
người tìm đến vào dịp gần đây vì lối kiến trúc đẹp trông như một Thái Lan thu nh
ỏ.
            </p>
              <a class="content-link" href="#">Chi tiết</a>
          </div>
           <div class="item">
              <img src="assets/image/xich_dang.jpg" class="place-img" >
              <h3 class="section-heading">Văn Miếu Xích Đằng</h3>
              <p class="about-text">
                Văn Miếu Xích Đằng toạ trên một khu đất cao, rộng gần 4000m2 thu
ộc địa phận thôn Xích Đằng, phường Lam Sơn. Hiện vật quý nhất của Văn Miếu chính 
là 9 tấm bia có ghi danh các nhà khoa bảng. Văn Miếu Xích Đằng là di tích minh 
              </p>
              <a class="content-link" href="#">Chi tiết</a>
          </div>
           <div class="item">
              <img src="assets/image/Đền Mẫu.jpg" class="place-img">
              <h3 class="section-heading">Đền Mẫu</h3>
              <p class="about-text">
               Đền Mẫu được coi là một danh lam thắng cảnh đẹp nhất của Phố Hiến
. Phía trước đền là hồ Bán Nguyệt có cây xanh râm mát, một bên là phố Nguyệt Hồ 
còn một bên là đê Đại Hà với không gian thoáng đãng. 
              </p>
              <a class="content-link" href="#">Chi tiết</a>
          </div>
           <div class="item">
            <img src="assets/image/ban_nguyet.jpg"  class="place-img">
              <h3 class="section-heading">Hồ Bán Nguyệt</h3>
              <p class="about-text">
                Dọc theo đường Bãi Sậy, nằm đối diện đền Mẫu, thuộc địa bàn của 
phường Quang Trung và cách trung tâm thành phố Hưng Yên khoảng 1km về phía Nam l
à du khách đến được Hồ Bán Nguyệt.
               </p>
              <a class="content-link" href="#">Chi tiết</a>
          </div>
        </div>
    </div>

-Specalities-
<div id="food" class="food-section">
        <h2 class="section-heading">ĐẶC SẢN</h2>
        <p class="section-sub-heading">Đặc sản Hưng Yên</p>
            <div class="food-list">
              <div class="item">
                <img src="assets/image/Nhãn lồng Hưng Yên.jpg" class="food-img">
                <h3 class="section-heading">Nhãn lồng Hưng Yên</h3>
                <p class="about-text">
                  Nhãn lồng trở thành niềm kiêu hãnh của mảnh đất Hưng Yên. Mùa 
tháng 7, tháng 8 đang là mùa nhãn lồng Hưng Yên chín rộ.
                  Nhãn lồng Hưng Yên quả to tròn, vỏ có màu vàng nâu nhạt, cùi d
ày, ráo nước, bóc một lớp vỏ mỏng láng để lộ lớp cùi nhãn dày trắng ngà, bên tro
ng là hạt nhỏ màu đen nháy, đưa vào miệng nếm thử có vị ngọt thơm, giòn dai. 
                </p>
                <a class="content-link" href=""> Địa điểm trồng nhãn lồng ngon n
hất</a>
              </div>
              <div class="item">
                <img src="assets/image/che_sen.jpg" class="food-img">
                <h3 class="section-heading">Chè sen long nhãn</h3>
                <p class="about-text">
                  Chè sen long nhãn là sự kết hợp tinh túy giữa hương vị trời và 
đất, vị ngọt thơm của long nhãn quyện lẫn vị bùi của hạt sen, tạo thành hương vị 
riêng biệt.
                </p>
                <a class="content-link"href=""> Cách làm chè sen long nhãn ngon, 
ngọt nhất</a>
              </div>
                <div class="item">
                <img src="assets/image/bun_thang.png" class="food-img">
                <h3 class="section-heading">Bún thang lươn</h3>
                <p class="about-text">
                    Nhắc đến đặc sản Phố Hiến, phải nói đến bún thang lươn. Bát 
bún như một thang thuốc quý bồi bổ cho sức khỏe và như bức tranh nghệ thuật sống 
động với đủ màu sắc của bún, lươn, trứng, giò, hành, răm… Người thưởng thức ẩm t
hực sành điệu sẽ tấm tắc khi cảm nhận vị ngọt đậm đà của nước dùng. 
                </p>
                <a  class="content-link"href=""> Cách làm bún thang lươn</a>
                </div>
              <div class="item">
                <img src="assets/image/Tương bần Hưng Yên.jpg" class="food-img">
                <h3 class="section-heading">Tương bần</h3>
                <p class="about-text">
                   Từ xa xưa tương Bần Hưng Yên là thứ sản vật ngon dùng để tiến 
vua. Ngày nay, tương Bần vẫn nổi tiếng khắp nơi và trở thành một loại nước chấm 
đặc sản khiến nhiều người “mê mẩn”. Chỉ cần gạo nếp cái hoa vàng, đỗ tương và mu
ối là đã có thể làm tương. Ba công đoạn chính là lên mốc xôi nếp, ngả đỗ và phơi 
tương (ủ tương). Tương Bần Hưng Yên có hương vị khó diễn giải. Cái vị ấy ẩn dưới 
độ sánh rất đậm đà, chìm trong vị ngọt ngon đặc trưng.
                </p>
                <a class="content-link" href=""> Nên mua tương bần chỗ nào Hưng 
Yên để làm quà?</a>             
              </div>
            </div>
    </div>

-Price-
<?php include_once 'function/price.php'; ?>

<div id="price" class="price-section">
        <h2 class="section-heading">BẢNG GIÁ</h2>
        <p class="section-sub-heading">Bảng giá các món ăn và đặc sản mua làm qu
à</p>
        <?php include_once 'include/notification.php'; ?>
        <div class="col-lg-12" style="margin-bottom: 20px;">
            <form action="" method="POST">
                <div class="input-group">
                <input type="number" name="key" required="" minlength="5" maxlen
gth="12" class="form-control" placeholder="Nhập giá...">
                <span class="input-group-btn">
                    <button name="search-specialties" class="btn btn-default" ty
pe="submit">Search</button>
                </span>
                </div>
            </form>
        </div>
        <div class="price-section">
          <table  style="width:100%;height:300px">
               <thead>
                    <tr style="background-color:pink">
                        <th>#</th>
                        <th>Các món ăn</th>
                        <th>Giá</th>
                        <th>Địa chỉ</th>
                        <th colspan="2">Hoạt động</th>
                    </tr>
                </thead>
                <tbody>
                    <?php  
                        if (isset($_POST['search-specialties'])) {
                            $price = $_POST['key'];
                            $specialties = searchSpecialties($price);
                    ?>
                            <div class="alert alert-success">
                                <button type="button" class="close" data-
dismiss="alert" aria-hidden="true">&times;</button>
                                <strong>Có <?php echo count($specialties) ?></
strong> kết quả được tìm thấy với từ khóa: <?php echo $price; ?>
                            </div>
                    <?php
                        }else{
                            $specialties = getSpecialties();
                        }
                        
                        $count = 0;
                        foreach ($specialties as $value) {
                            $count += 1;
                    ?>
                        <tr>
                            <td><?php echo $count; ?></td>
                            <td><?php echo $value['name']; ?></td>
                            <td><?php echo $value['price']; ?></td>
                            <td><?php echo $value['address']; ?></td>
                            <td>
                                <a href="index.php?page=edit-specialties&id=<?
php echo $value['id']; ?>">
                                    <i class="fa fa-edit fa-2x"></i>
                                </a>
                            </td>
                            <td>
                                <a href="index.php?page=delete&id=<?php echo $va
lue['id']; ?>" onclick="return confirm('Bạn có chắc chắn xóa không ?')"><span cl
ass="badge badge-danger">Xóa</span></a>
                                
                                </a>
                            </td>
                        </tr>
                    <?php
                        }
                    ?>
                </tbody>
        </table>
        <button class="btn btn-primary" onclick="window.open('index.php?
page=insert', '_self')">Thêm</button>
        </div>
</div>

<link rel="stylesheet" href="../assets/fontawesome-free-5.15.3-web/css/
fontawesome.min.css">

   

---Thêm, sửa, xóa, tìm kiếm---


<?php  

    function getSpecialties(){
        global $conn;
        $result = array (); 
        $sql = "SELECT *FROM price";
        $query = mysqli_query($conn, $sql);
        while ($row = mysqli_fetch_assoc($query)) {
            $result[] = $row;
        }
        return $result;
    }

    
    function getSpecialtiesID($id){
        global $conn;
        $result = array();

        $sql = "SELECT *FROM price WHERE id = $id";
        $query = mysqli_query($conn, $sql);
        while ($row = mysqli_fetch_assoc($query)) {
            $result = $row;
        }
        return $result;
    }

    
    function updateSpecialties($id, $name, $price, $address){
        global $conn;
        $sql = "UPDATE price SET name = '$name', price = '$price', address = '$a
ddress' WHERE id = $id";
        return mysqli_query($conn, $sql);
    }

    
    function searchSpecialties($price){
        global $conn;
        $result = array();

        $sql = "SELECT * FROM price WHERE price = $price";
        $query = mysqli_query($conn, $sql);
        while ($row = mysqli_fetch_assoc($query)) {
            $result[] = $row;
        }
        return $result;
    }
    function insertSpecialties($name, $price, $address){
        global $conn;
        $sql = "INSERT INTO price(name, price, address)
                VALUE ('$name', '$price', '$address')";

        return mysqli_query($conn, $sql) ;
    }

?>

<?php
  include_once 'function/price.php'; 
  if(!empty($_POST)) {
    
    if(isset($_POST['name'])){
      $name =$_POST['name'];
    }
    if(isset($_POST['price'])){
      $price =$_POST['price'];
    }
    if(isset($_POST['address'])){
      $address =$_POST['address'];
    }
    
    $insert= insertSpecialties($name, $price, $address);

    if($insert){
      echo "Thêm thành công";
      header('location: index.php?page=price');    
    }
    else{
      echo "Thất bại";
    }
  }
?>

<div class="form">
        <form action="" method="POST" >
            <label for="name">Tên món ăn</label>
            <input type="text" required id="name" name="name">
    
            <label for="name">Giá</label>
            <input type="text" id="price" name="price">
    
            <label for="name">Địa chỉ</label>
            <input type="text" id="address" name="address">
    
            <button type="submit" name="update-pecialties" class="btn-
primary">Thêm</button>
        </form>
    </div>

      

<?php 
    include_once 'function/price.php'; 
    if (isset($_GET['id'])) {
        $id = (int)$_GET['id'];
        $food = getSpecialtiesID($id);
        if (count($food) == 0) {
            header('location: index.php?page=price');
        }
        if (isset($_POST['update-pecialties'])) {
            $name           = $_POST['name'];
            $price          = $_POST['price'];
            $address         = $_POST['address'];

            $update = updateSpecialties($id, $name, $price, $address);
            if ($update) {
                $_SESSION['noti'] = 1;
                header('location: index.php?page=price');
            }
        }

        
    }else{
        header('location: index.php?page=price');
    }
    
?>
    <div class="form">
        <form action="" method="POST" >
            <label for="name">Tên món ăn</label>
            <input type="text" required id="name" name="name" value="<?php echo 
$food['name']; ?>">
    
            <label for="name">Giá</label>
            <input type="text" id="price" name="price" value="<?php echo $foo
d['price']; ?>">
    
            <label for="name">Địa chỉ</label>
            <input type="text" id="address" name="address" value="<?php echo $fo
od['address']; ?>">
    
            <button type="submit" name="update-pecialties" class="btn-
primary">Update</button>
        </form>
    </div>

<?php
    
    $id=$_GET['id'];
    $sql= "DELETE from price WHERE id= $id";
  
    $qr = mysqli_query($conn,$sql);
    header('location: index.php?page=price');
?>

-Advisory-

<div class="form">
  <h2 class="section-heading">Đăng ký nhận tư vấn</h2>
    <form action="" method="POST" onsubmit="return validateForm()">
      <label for="name">Họ Tên<span id="error-name"> (*)</span></label><br>
      <input type="text" name="name" id="name"><br><br>
      <label for="name">Email<span id="error-email"> (*)</span></label><br>
      <input type="text" name="email" id="email"><br><br>
      <label for="number">Số Điện Thoại<span id="error-phone"> (*)</span></
label><br>
      <input type="text" name="phone" id="phone"><br><br>
      <label for="address">Địa Chỉ<span id="error-address"> (*)</span></
label><br>
      <input type="text" name="address" id="address"><br><br>
      <input type="submit" name="click" value="Đăng kí" class="btn-primary">
      <input type="reset" class="btn-primary" onclick="document.write('Đã xóa th
ành công')" value="Xóa">
    </form>
</div>

<script>
    function validateForm(){
        var name = document.getElementById('name').value;
        var errorName = document.getElementById('error-name');
        var regexName = /^[^\d+]*[\d+]{0}[^\d+]*$/;

        if(name == '' || name == null){
            errorName.innerHTML = ' Họ tên không được để trống!';
            document.getElementById('name').focus();
        }else if(!regexName.test(name)){
            errorName.innerHTML = ' Họ tên sai định dạng!';
        }else{
            errorName.innerHTML = '';
        }
         //check email
         var email = document.getElementById('email').value;
        var errorEmail = document.getElementById('error-email');
        var regexEmail =  /[A-Z0-9._%+-]+@[A-Z0-9-]+.+.[A-Z]{2,4}/igm;

        if(email =='' || email == null){
            errorEmail.innerHTML = ' Email không được để trống!';
        }else if(!regexEmail.test(email)){
            errorEmail.innerHTML = ' Email sai định dạng!';
        }else{
            errorEmail.innerHTML = '';
        }
        //check phone
        var phone = document.getElementById('phone').value;
        var errorPhone = document.getElementById('error-phone');
        var regexPhone = /^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]
{4,6}$/im;

        if(phone == '' || phone == null){
            errorPhone.innerHTML = ' SĐT không được để trống!';
        }else if(!regexPhone.test(phone)){
            errorPhone.innerHTML = ' SĐT không đúng định dạng!';
        }else{
            errorPhone.innerHTML ='';
        }
        //check address
        var address = document.getElementById('address').value;
        var errorAddress = document.getElementById('error-address');
        if(address == '' || address == null){
            errorAddress.innerHTML = ' Địa chỉ không được để trống!';
        }else{
            errorAddress.innerHTML ='';
        }
        if(name && email && phone && address){
            window.location.href = "admin/index.php";
        }
        return false;
    }

</script>

You might also like