|
|
|
ดึงข้อมูลจากฐานข้อมูลมาใส่ใน jump menu คือ อยากทราบโค๊ด ที่จะดึงข้อมูลจากฐานข้อมูล |
|
|
|
|
|
|
|
Code (PHP)
<!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=windows-874" />
<title>Untitled Document</title>
<script type="text/javascript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM customer";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<form id="form1" name="form1" method="post" action="">
ชื่อลูกค้า :
<select name="jumpMenu" id="jumpMenu" onchange="MM_jumpMenu('parent',this,0)">
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<option value="main.php?name=<?=$objResult["Name"]?>"><?=$objResult["Name"]?></option>
<?
}
?>
</select>
<?
mysql_close($objConnect);
?>
</form>
</body>
</html>
|
|
|
|
|
Date :
2010-03-11 08:07:37 |
By :
panyapol |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|