Wednesday, 12 January 2022

PHP#17MySQL#13 - Admin/theloai.php - Lọc thể loại theo ngôn ngữ, selected ngôn ngữ, chuyển trang kèm theo ngôn ngữ

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Thể Loại</title>

</head>


<body>

<p>

<?php 

if(isset($_GET['lang'])) $lang=$_GET['lang'];

else $lang="vi";

?>

 <form id="form1" name="form1" method="get" action="">

  <label for="lang">Chọn ngôn ngữ:</label>

  <select name="lang" id="lang" onChange="form1.submit();">

    <option value="vi">Việt</option>

    <option value="en"<?php if($lang=="en") echo "selected";?>>English</option>

  </select>

 </form>

</p>

<table width="700" border="1" cellspacing="0" cellpadding="0">

  <tbody>

    <tr>

      <th scope="col">Thứ tự</th>

      <th scope="col">Tên thể loại</th>

      <th scope="col">Tên không dấu</th>

      <th scope="col">Trang thái</th>

      <th scope="col"><a href="theloai_them.php?lang=<?php echo $lang;?>">Thêm</a></th>

    </tr>

    <?php

include("../connect.php");

$sl="select * from theloai where lang='$lang' order by ThuTu";

$kq=mysqli_query($link,$sl);

while($d=mysqli_fetch_array($kq)){

?>

    <tr>

      <td><?php echo $d['ThuTu'];?></td>

      <td><?php echo $d['TenTL'];?></td>

      <td><?php echo $d['TenTL_KhongDau'];?></td>

      <td><?php if($d['AnHien']) echo "Hiện"; else echo "Ẩn";?></td>

      <td>Xóa/Sửa</td>

    </tr>

    <?php }?>

  </tbody>

</table>


</body>

</html>

0 comments:

Post a Comment