Skip to main content

Posts

PHP#20MySQL#16 - upfiles.php

 <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <form method="post" enctype="multipart/form-data" name="form1" id="form1">   <input type="hidden" name="MAX_FILE_SIZE" value="102400"/>   <label for="upfile">File:</label>   <input type="file" name="upfile" id="upfile">   <input type="submit" name="submit" id="submit" value="Submit"> </form> <?php if(isset($_FILES['upfile'])) { //Thư mục để chứa file: $target="files/"; //lấy tên: $filename=basename($_FILES['upfile']['name']); //abc.jpg đang ở c:/hinh/abc.jpg $target=$target.$filename; //kiểm tra file đã có chưa: if(file_exists($target)) echo "File đã tồn tại!"; else echo ...

PHP#20MySQL#16 - tin.php : Lọc tin theo Ngôn ngữ, Thể loại, Loại & Phân trang

//tin.php  <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <style> .ht{ font-weight: bold; color:#E80206; font-size:20px;} </style> </head> <body> <?php include("../connect.php");  if(isset($_GET['lang'])) $lang=$_GET['lang']; else $lang="vi"; ?> <form method="get" id="form1" name="form1" action="">   <p>     <label for="idTL">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>   <p>     <label for="idTL">Thể loại:</label>     <select name=...

PHP#20MySQL#16 - Xóa LOẠI TIN

//loaitin.php (phần Xóa) <!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 "selected";?>>English</option>     </select>   </p>   <p>     <label for="theloai">Thể loại:</label>     <select name="theloai" id="theloai" onChange="form1.submit();"> <?php  ...

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