|
 |
|
ทำยังให้ สามารถเลือก select Box ได้พร้อมกันทั้ง 2 อัน |
|
 |
|
|
 |
 |
|
ตัด code เฉพาะส่วนที่มีปัญหามาโพสครับ ขี้เกียจนั่งไล่ -.-"
|
 |
 |
 |
 |
Date :
2018-01-29 12:12:39 |
By :
dudesaranyu |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
นี้ครับส่วนที่มีปัญหา
Code (PHP)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
</head>
<body>
<?php
$con = mysql_connect("localhost","root","2461330210")or die("ERROR".mysql_error());
mysql_select_db("project2",$con)
?>
<form action="2.php" method="post" name="form1">
<select name="lmName" OnChange="window.location='?item='+this.value;">
<option value=""><-- Please Select Item --></option>
<?php
$strSQL = "SELECT * FROM sub ORDER BY sub ASC";
$objQuery = mysql_query($strSQL);
while($objResult2 = mysql_fetch_array($objQuery))
{
if($_GET["item"] == $objResult2["sub"])
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?php echo $objResult2["sub"];?>" <?php echo $sel;?>><?php echo $objResult2["sub"];?></option>
<?php
}
?>
</select>
<?php
if($_GET["item"] != "")
{
$strSQL = "SELECT * FROM sub WHERE sub = '".$_GET["item"]."' ";
$objQuery = mysql_query($strSQL);
$objResult3 = mysql_fetch_array($objQuery);
}
?>
</form>
<form action="2.php" method="post" name="form1">
<select name="lmName1" OnChange="window.location='?item='+this.value;">
<option value=""><-- Please Select Item --></option>
<?php
$strSQL = "SELECT * FROM teacher ORDER BY teacher ASC";
$objQuery = mysql_query($strSQL);
while($objResult = mysql_fetch_array($objQuery))
{
if($_GET["item"] == $objResult["teacher"])
{
$sel = "selected";
}
else
{
$sel = "";
}
?>
<option value="<?php echo $objResult["teacher"];?>" <?php echo $sel;?>><?php echo $objResult["teacher"];?></option>
<?php
}
?>
</select>
<?php
if($_GET["item"] != "")
{
$strSQL = "SELECT * FROM teacher WHERE teacher = '".$_GET["item"]."' ";
$objQuery = mysql_query($strSQL);
$objResult2 = mysql_fetch_array($objQuery);
}
?>
</form>
<button>Submit</button>
<div class="demo-info" style="margin-bottom:10px">
<div class="demo-tip icon-tip">
</div>
</div>
<div class="item-container"><div class="item-content" style="text-align: center;"><div></div></div></div>
<div style="width:700px;">
<div class="left">
<table>
<tr>
<td><div class="item"><?php echo $objResult3["sub"];?></div></td>
</tr>
<tr>
<td><div class="item"><?php echo $objResult2["teacher"];?></div></td>
</tr>
</table>
</div>
</body>
</html>
|
ประวัติการแก้ไข 2018-01-29 14:01:17 2018-01-29 14:01:21
 |
 |
 |
 |
Date :
2018-01-29 12:26:10 |
By :
daimond2539 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|