Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > แสดงผลรายงานจากการเลือกรายการจากช่อง Listmenu จะต้องเขียนโค๊ดอย่างไรครับ???



 

แสดงผลรายงานจากการเลือกรายการจากช่อง Listmenu จะต้องเขียนโค๊ดอย่างไรครับ???

 



Topic : 041169



โพสกระทู้ ( 80 )
บทความ ( 0 )



สถานะออฟไลน์




เรียน พี่ ๆ ทุกท่าน

จากรูป ผมจำลองตัวอย่างมาให้ คือว่าผมต้องการแสดงผลรายงานตามรายการที่ได้
เลือกจากช่อง ListMenu ว่าจะต้องเขียนโค๊ดอย่างไร ขอคำแนะนำด้วยนะครับ..
ReportListmenu

ขอรบกวนด้วยนะครับ ขอขอบคุณมาก ๆ ครับ



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-04-02 13:26:01 By : riderman View : 1155 Reply : 10
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<?
	mysql_connect("localhost","root","root") or die(mysql_error());
	mysql_select_db("mydatabase");
?>
<body>
	<form action="php_listmenu_datebase2.php" method="post" name="form1">
		List Menu<br>
		  <select name="lmName1">
			<option value=""><-- Please Select Item --></option>
			<?
			$strSQL = "SELECT * FROM customer ORDER BY CustomerID ASC";
			$objQuery = mysql_query($strSQL);
			while($objResuut = mysql_fetch_array($objQuery))
			{
			?>
			<option value="<?=$objResuut["CustomerID"];?>"><?=$objResuut["CustomerID"]." - ".$objResuut["Name"];?></option>
			<?
			}
			?>
		  </select>
		<input name="btnSubmit" type="submit" value="Submit">
	</form>
</body>
</html>
<?
	mysql_close();
?>







Date : 2010-04-03 09:41:50 By : webmaster
 


 

No. 2



โพสกระทู้ ( 80 )
บทความ ( 0 )



สถานะออฟไลน์


เีรียน พี่ MR.WIN ครัีบ

มันไม่ใช่อย่างที่ผมต้องการนะครับ โค๊ดที่พี่เขียนมาให้ดูเป็นตัวอย่างนั้น มันเป็นการเขียน
ช่อง List menu โดยดึงข้อมูลจากฐานจากตารางเดียว

แต่ที่ผมจะทำจริงมันเป็น 2 ตารางนะครับ และต้องการเอามาทำ ListMenu แล้วเลือกรายการที่ต้องการ
จากนั้นแสดงรายการที่เลือกนะครับ (ดังตัวอย่างนะครับ)

ขอรบกวนอีกครั้่งนะครับ ขอขอบคุณมาก ๆ ครับ
Date : 2010-04-03 17:00:46 By : riderman
 

 

No. 3



โพสกระทู้ ( 80 )
บทความ ( 0 )



สถานะออฟไลน์


<meta http-equiv="Content-Type" content="text/html; charset=tis620" />
<title>Untitled Document</title>
</head>
<body>
<form action="" method="get" enctype="multipart/form-data" name="frm" id="frm">
<table width="21%" border="1" align="center" cellpadding="1" cellspacing="2">
<tr>
<td height="36" colspan="2" bgcolor="#E2E2E2" align="right">
<?php
$connDB = mysql_connect("localhost","user","user") or die ("Cannot connect to Database");
mysql_query("SET NAMES tis620", $connDB);
mysql_query("USE db_report");

$sql = "SELECT * FROM tb_com
INNER JOIN tb_status ON tb_status.idStatus = tb_com.idStatus
GROUP BY tb_com.idStatus
ORDER BY tb_com.idCom ASC";
$result = mysql_query($sql) or die ("<script>alert('Cannot connect to Database');</script>");
?>
<b>เลือกสถานะ :</b>
<select name="searchStatus" id="searchStatus">
<option value=""> -- เลือกทั้งหมด --</option>
<?php // Loop Status
while($row = mysql_fetch_array($result)){
?>
<option value=""><?php echo $row['decription'];?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td width="61%" height="21" bgcolor="#909090" align="center" class="txt-H">รายการ</td>
<td width="39%" bgcolor="#909090" align="center" class="txt-H">สถานะ</td>
</tr>
<?php
$sqlST = "SELECT * FROM tb_com
INNER JOIN tb_status ON tb_status.idStatus = tb_com.idStatus
ORDER BY tb_com.idCom ASC";
$resultST = mysql_query($sqlST) or die ("<script>alert('Cannot connect to Database');</script>");
while($rowST = mysql_fetch_array($resultST)){
?>
<tr>
<td height="30"><?php echo $rowST['detail'];?></td>
<td><?php echo $rowST['decription'];?></td>
</tr>
<?php } ?>
</table>
</form>
</body>
</html>
-------------------------------------------------------
จะได้หน้าจอดังนี้ :-
reportListMenu
-------------------------------------------------------
แต่ก็ยังไม่ตรงกับความต้องการของผมเลย เพราะหากเลือกช่องรายการใน Listmenu อยากให้ออกแสดงรายการที่เลือกนะครับ
จึงขอรบกวนพี่ๆ ช่วยแนะนำให้ด้วยนะครับ ขอขอบคุณมาก ๆ ครับ
Date : 2010-04-07 12:17:05 By : riderman
 


 

No. 4

Guest


<meta http-equiv="Content-Type" content="text/html; charset=tis620" />
<title>Untitled Document</title>
</head>
<body>
<form action="" method="get" enctype="multipart/form-data" name="frm" id="frm">
<table width="21%" border="1" align="center" cellpadding="1" cellspacing="2">
<tr>
<td height="36" colspan="2" bgcolor="#E2E2E2" align="right">
<?php
$connDB = mysql_connect("localhost","user","user") or die ("Cannot connect to Database");
mysql_query("SET NAMES tis620", $connDB);
mysql_query("USE db_report");

$sql = "SELECT idStatus, description
FROM tb_Status
ORDER BY description";
$result = mysql_query($sql) or die ("<script>alert('Cannot connect to Database');</script>");
?>
<b>เลือกสถานะ :</b>
<select name="searchStatus" id="searchStatus">
<option value=""> -- เลือกทั้งหมด --</option>
<?php // Loop Status
while($row = mysql_fetch_array($result)){
?>
<option value="<?=$row['idStatus']?>"><?php echo $row['decription'];?></option>
<?php } ?>
</select>
</td>
</tr>
<tr>
<td width="61%" height="21" bgcolor="#909090" align="center" class="txt-H">รายการ</td>
<td width="39%" bgcolor="#909090" align="center" class="txt-H">สถานะ</td>
</tr>
<?php
$sqlST = "SELECT * FROM tb_com
INNER JOIN tb_status ON tb_status.idStatus = tb_com.idStatus
WHERE 1
"

if ($_GET['searchStatus'] <> '') {
$sqlST .= " AND tb_Com.idStatus = '".$_GET['searchStatus']."' ";
}

$sqlST .= " ORDER BY tb_com.idCom ASC";
$resultST = mysql_query($sqlST) or die ("<script>alert('Cannot connect to Database');</script>");
while($rowST = mysql_fetch_array($resultST)){
?>
<tr>
<td height="30"><?php echo $rowST['detail'];?></td>
<td><?php echo $rowST['decription'];?></td>
</tr>
<?php } ?>
</table>
</form>
</body>
</html>

อย่างนี้ได้ไหมครับ
ลองดู
Date : 2010-04-07 13:58:34 By : www
 


 

No. 5



โพสกระทู้ ( 80 )
บทความ ( 0 )



สถานะออฟไลน์


ขอขอบคุณมาก ๆ ครับ
แต่ผมได้เอาโค๊ดมาลองรันแล้ว ก็ไม่สามารถเลือกรายการได้เลย กดลิงค์เลือกรายการของสถานะแล้วก็ไม่มีอะไรเปลี่ยนแปลงเลยนะครับ

ขอรบกวนช่วยเหลือด้วยนะครับ ขอขอบคุณล่วงหน้ามา ณ ที่นี้เลยครับ
Date : 2010-04-07 17:08:15 By : riderman
 


 

No. 6



โพสกระทู้ ( 8 )
บทความ ( 0 )



สถานะออฟไลน์


ในเว็บนี้แหละมีตัวอย่างให้แล้วนะครับ ลองหาดู เคยโพสไว้แว้ว
Date : 2010-04-07 18:25:33 By : mungkey
 


 

No. 7



โพสกระทู้ ( 80 )
บทความ ( 0 )



สถานะออฟไลน์


ก็หาไม่เจอสักทีนะครับ มันก็ไม่ตรงสักที ช่วยผมด้วยนะครับ ขอขอบคุณมากครับ
Date : 2010-04-08 10:17:28 By : riderman
 


 

No. 8

Guest


<?
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620" />
<title>SYSTEM ANALYSIS AND DESIGN</title>
<link href="../style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="926" border="0" cellpadding="0" cellspacing="0" align="center" style="border: 1px solid gray;">
<tr>
<td height="200" colspan="2" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="920" height="200">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="920" height="200">
<param name="movie" value="../Flash/header3.swf" />
<param name="quality" value="high" />
<embed src="../Flash/header3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="920" height="200"></embed>
</object>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="28" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="920" height="20">
<span class="style7">
<marquee>
<span class="style6">Rajamangala University of Technology Isan Sakon nakhon Campus / Bachelor of Business Administration Program in Computer Information Systems </span>
</marquee>
</span>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" rowspan="2" colspan="2" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border: 1px solid gray;">
<tr>
<td width="100%" height="47" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="../img/mmm.gif" style="background-repeat:repeat-x">
<!--DWLayoutTable-->
<tr>
<td width="100%" height="47" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="100%" height="47"><div align="center" class="style13"><b><a href="index.php">Administrator</a></b></div></td>
</tr>
</table> </td>
</tr>
<tr>
<td height="360" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="100%" height="17" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="100%" height="21" align="center"><span class="style19">[ <a href="../select_content/select_content.php" target="_parent">หน้าหลักระบบ</a> ]
[ <a href="edit.php">แก้ไขข้อมูลส่วนตัว</a> ]
[ <a href="view.php">จัดการสมาชิกทั้งหมด</a> ] [ <a href="../news/menu_admin.php" target="_blank">จัดการข่าว</a> ] [ <a href="admin_m_test.php">จัดการข้อสอบ</a> ]
[ <a href="logout.php">ออกจากระบบ</a> ]&nbsp;</span></td>
</tr>
<tr>
<td height="142" valign="top"><table width="100%" border="0" cellpadding="4" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="100%" height="142">
<form action="view.php" method="get">
<select name="room" id="view">
<option value="">ทั้งหมด</option>
<option value="IS1B">IS1B</option>
<option value="IS2B">IS2B</option>
<option value="IS3B">IS3B</option>
<option value="IS4B">IS4B</option>
<option value="ISR3B">ISR3B</option>
<option value="ISR4B">ISR4B</option>
</select>
<input type="submit" name="search" id="search" value="Submit"/>
</form>
<table border="1" align="center" class="style19">
<tr bgcolor="#D3D3D3">
<td><div align="center">ลำดับ</div></td>
<td width="180"><div align="center">ชื่อ&nbsp;&nbsp;&nbsp;&nbsp;สกุล</div></td>
<td width="60"><div align="center">ห้อง</div></td>

<td width="120"><div align="center">วันที่ลงทะเบียน</div></td>
<td><div align="center">Pretest บทที่ 1</div></td>
<td><div align="center">Postest บทที่ 1</div></td>
<td><div align="center">Pretest บทที่ 2</div></td>
<td><div align="center">Postest บทที่ 2</div></td>
<td><div align="center">Pretest บทที่ 3</div></td>
<td><div align="center">Postest บทที่ 3</div></td>
<td><div align="center">Pretest บทที่ 4</div></td>
<td><div align="center">Postest บทที่ 4</div></td>
<td> <div align="center">ลบ</div></td>
</tr>
<?
$count=0;
include "../include/connect.php";
$room= $_GET['room'];
if($room == "IS1B") {
$sql="select * from tb_member where room='IS 1B' order by name";
}else if($room == "IS2B") {
$sql="select * from tb_member where room='IS 2B' order by name";
}else if($room == "IS3B") {
$sql="select * from tb_member where room='IS 3B' order by name";
}else if($room == "IS4B") {
$sql="select * from tb_member where room='IS 4B' order by name";
}else if($room == "ISR3B") {
$sql="select * from tb_member where room='ISR 3B' order by name";
}else if($room == "ISR4B") {
$sql="select * from tb_member where room='ISR 4B' order by name";
}else {
$sql="select * from tb_member order by name";
}
$result=mysql_db_query($dbname,$sql);
while($record=mysql_fetch_array($result)) {
$count++;
echo "
<tr>
<td>$count</td>
<td>$record[name]&nbsp;&nbsp;&nbsp;&nbsp;$record[surname]</td>
<td>$record[room]</td>
<td align='center'>$record[reg_date]</td>
<td>$record[pretest]</td>
<td>$record[postest]</td>
<td>$record[pretest2]</td>
<td>$record[postest2]</td>
<td>$record[pretest3]</td>
<td>$record[postest3]</td>
<td>$record[pretest4]</td>
<td>$record[postest4]</td>
<td><a href=\"delete.php?id_del=$record[id]\" onclick=\"return confirm(' ต้องการลบ $record[name] ออกจากระบบจริงหรือไม่ ')\">ลบ</a></td>
</tr>";
}
mysql_close();
?>
</table>
</td>
</tr>

</table></td>
</tr>
<tr>
<td></td>
</tr>
</table></td>
</tr>
<tr>
<td ></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>

</td>
</tr>
<tr>
<td height="2"></td>
</tr>
<tr>
<td colspan="2" valign="top">
<?
include "footer.php";
?>
</td>
</tr>
</table>
</body>
</html>
Date : 2010-06-12 21:37:33 By : tonsek
 


 

No. 9



โพสกระทู้ ( 66 )
บทความ ( 0 )



สถานะออฟไลน์


Left join
Date : 2010-08-27 19:13:35 By : thaic
 


 

No. 10



โพสกระทู้ ( 616 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Facebook

ลองแบบนี้สิ น่าจะได้นะ


$select = "SELECT * FROM tb_Status ORDER BY Description ASC";
$query = mysql_query($select);

<select name="searchStatus" style="width:100px; ">

<?php while($rows = mysql_fetch_array($query)){?>

<option value="<?php echo"$rows['idStatus']"; ?>">-- <?php echo"$rows['decription']"; ?> --</option>

</select>


///แสดง

<?
if($_GET['searchStatus']){

$strSQL = "SELECT * FROM tb_Com where idStatus='$searchStatus'ORDER BY idCom ASC";
$querys= mysql_query($strSQL);
?>

<?
while($objResult = mysql_fetch_array($querys))
{
$strSQLs = "SELECT * FROM tb_Status where idStatus='objResult[idStatus]'";
$queryss= mysql_query($strSQLs);
?>

///ชื่อ

<?=$objResult['detail'];?>

///สถานะ

<?=$objResultss['decription'];?>
<?

}

?>

<?

}

?>

ยังไงลองไปดับแปลงเอานะ


ประวัติการแก้ไข
2010-08-27 21:10:31
Date : 2010-08-27 21:09:23 By : slurpee55555
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : แสดงผลรายงานจากการเลือกรายการจากช่อง Listmenu จะต้องเขียนโค๊ดอย่างไรครับ???
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่