Skip to main content

Posts

PHP#19MySQL#15 - Loại tin, Thêm, Sửa, Xử lý

//connect.php <?php $link=@mysqli_connect("localhost","root","") or die("Không tìm thấy Sever"); mysqli_select_db($link,"tintuc") or die("Không tồn tại DB"); mysqli_query($link,"set names 'utf8'"); ?> //loaitin.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>Loại Tin</title> </head> <body> <?php include("../connect.php"); if(isset($_GET['lang'])) $lang=$_GET['lang']; else $lang="vi"; ?> <form method="get" id="form1" name="form1"> <p> <label for="loaitin">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 "...

PHP#18MySQL#14 - Thêm, Xóa, Sửa, Lọc theo ngôn ngữ, lọc theo thể loại, loại

  //theloai.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>Thể Loại</title> </head> <body> <?php include("../connect.php"); if(isset($_GET['lang'])) $lang=$_GET['lang']; else $lang="vi"; ?> <form method="get" id="form1" name="form1">   <p>     <label for="select">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>   </p> </form> <table width="700" border="1" cellspacing="0" cellpadding="0">   <tbody>     <tr>       <th scope="col">Thứ tự</t...

PHP#17MySQL#13 - Trang xử lý THÊM dữ liệu (process.php) - Chuyển trang trong PHP: header("location:theloai.php");

<?php  include("../connect.php"); if(isset($_POST['themtl'])) { $sl="insert into theloai values(NULL,'{$_POST['lang']}', '{$_POST['TenTL']}', '{$_POST['TenTL_KhongDau']}', {$_POST['ThuTu']}, {$_POST['AnHien']})"; if(mysqli_query($link,$sl)) header("location:theloai.php"); else echo $sl; } ?>

PHP#17MySQL#13 - Admin/theloai_them.php - $_GET['lang']) sau đó selected ngôn ngữ

 <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php  if(isset($_GET['lang'])) $lang=$_GET['lang']; else $lang="vi"; ?> <form method="post" id="form1" name="form1" action="process.php" >   <p>     <label for="lang">Ngôn ngữ:</label>     <select name="lang" id="lang">       <option value="vi">Việt</option>       <option value="en" <?php if($lang=="en") echo "selected";?> >English</option>     </select>   </p>   <p>     <label for="ThuTu">Thứ tự:</label>     <input name="ThuTu" type="text" id="ThuTu" size="5">   </p>   <p>     <label for="TenTL">Tên TL:</label...

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ê...

PHP#17MySQL#13 - tin cũ hơn

//chitiettin.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <?php if(isset($_GET['idTin'])) { $idTin=$_GET['idTin']; include("connect.php"); $sl="select idLT, TieuDe, TomTat, Content from tin where idTin=$idTin"; $kq=mysqli_query($link,$sl); $d=mysqli_fetch_array($kq) ?> <h1 align="center"><?php echo $d['TieuDe'];?></h1> <div><?php echo $d['TomTat'];?></div> <div><?php echo $d['Content'];?></div> <?php }?> <p> các tin cũ hơn(lấy 5 tin cũ hơn và cùng loại tin với tin đang mở, sắp xếp từ mới đến cũ </p> <ul> <?php  $sltc="select * from tin where AnHien=1 and idLT={$d['idLT']} and idTin < $idTin order by idTin DESC limit 0,5"; $kqtc=mysqli_query($link,$sltc); while($dtc=...

PHP#16MySQL#12 - index.php, include

https://app.mediafire.com/fwx971t2bbggr  //index.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <link href="c2.css" rel="stylesheet" type="text/css"> </head> <body> <div id="container"> <div id="header"> </div>    <div id="thanhmenu"><?php include("menu.php");?></div>   <div id="main1">     <div id="main1_1"><?php include("tinnoibat.php");?></div> <div id="main1_2"><?php include("tinxemnhieu.php");?></div> <div id="main1_3">  </div> </div> <div id="quangcao"> </div> <div id="main2"> <div id="main2_1"> <?php  if(isset($_GET['key'])) { switch($_GET['key'])...