Skip to main content

Posts

Showing posts from December 17, 2021

b2.php - PHP#9MySQL#5 - Submit bằng lệnh JavaScrip: onChange="form1.submit();" thay thế nút Submit - Dùng Selected khi chọn đối tượng

//connect.php <?php //Kết nối đến server DB: $link=@mysqli_connect("localhost","root","") or die("Không thể kết nối đến Server!"); //Chọn database cần thao tác: mysqli_select_db($link,"webtintuc") or die("Không tồn tại DB này!"); mysqli_query($link,"set names 'utf8'"); ?> //b2.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>b2_duc.php</title> </head> <body> <form method="get" id="form1" name="form1"> <p> <label for="chungloai">Chủng loại sp:</label> <select name="chungloai" id="chungloai" onChange="form1.submit(); "> <?php include("connect.php"); $sl="select * from webtm_chungloaisp"; $kq=mysqli_query($link,$sl); while($d=mysqli_fetch_array($kq)) { ?> <option value="...

b1.php - PHP#9MySQL#5 - Lọc sản phẩm

//connect.php <?php //Kết nối đến server DB: $link=@mysqli_connect("localhost","root","") or die("Không thể kết nối đến Server!"); //Chọn database cần thao tác: mysqli_select_db($link,"webtintuc") or die("Không tồn tại DB này!"); mysqli_query($link,"set names 'utf8'"); ?> //b1.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>b1_duc.php</title> </head> <body> <form method="get" id="form1" name="form1"> <p> <label for="chungloai">Chủng loại sp:</label> <select name="chungloai" id="chungloai"> <?php include("connect.php"); $sl="select * from webtm_chungloaisp"; $kq=mysqli_query($link,$sl); while($d=mysqli_fetch_array($kq)) { ?> <option value="<?php echo $d['idCL'];?>...

theloaibh.php, dsbh.php - PHP#9MySQL#5 - bắt đối tượng khi click, liên kết qua trang khác để hiện thị nội dung tương ứng $_GET[' '] trong PHP

 //connect.php <?php //Kết nối đến server DB: $link=@mysqli_connect("localhost","root","") or die("Không thể kết nối đến Server!"); //Chọn database cần thao tác: mysqli_select_db($link,"webtintuc") or die("Không tồn tại DB này!"); mysqli_query($link,"set names 'utf8'"); ?> //theloaibh.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>theloaibh.php</title> </head> <body> <?php include("connect.php"); $sl="select * from webnhac_theloai"; $kq=mysqli_query($link,$sl); while($d=mysqli_fetch_array($kq)) { ?> <p><a href="dsbh.php?idTL=<?php echo $d['idTL'];?>"><?php echo $d['TenTL'];?></a></p> <?php } ?> </body> </html>