|
 |
|
**ถามเกี่ยวกับ DependantListMenu ครับ* คือผมได้ลองโหลดตัวอย่างจากเว็บ พร้อมทั้ง ฐานข้อมูล |
|
 |
|
|
 |
 |
|
คือผมได้ลองโหลดตัวอย่างจากเว็บ พร้อมทั้ง ฐานข้อมูล สามารถแสดงข้อมูลได้แล้ว มันไม่มีปุ่ม submit ผมก็
เลยเขียนเพิ่ม แต่มันไม่ยอม submit ครับ คลิ๊ก แล้วก็อยู่ที่เดิม ไม่ยอมไปใหนเลย ช่วยดูให้หน่อยครับ ว่าจะต้องแก้หรือ
เพิ่มโค๊ดอะไรตรงใหน
<?php
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("thailand");
@mysql_query("SET NAMES UTF8");
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>ThaiCreate.Com ListMenu</title>
<script language = "JavaScript">
function ListProvince(SelectValue)
{
frmMain.ddlProvince.length = 0
frmMain.ddlAmphur.length = 0
var myOption = new Option('','')
frmMain.ddlProvince.options[frmMain.ddlProvince.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM province ORDER BY PROVINCE_ID ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = <?=$objResult["GEO_ID"];?>;
strValue = "<?=$objResult["PROVINCE_ID"];?>";
strItem = "<?=$objResult["PROVINCE_NAME"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.ddlProvince.options[frmMain.ddlProvince.length]= myOption
}
<?
}
?>
}
//**** List Province (End) ***/
//**** List Amphur (Start) ***//
function ListAmphur(SelectValue)
{
frmMain.ddlAmphur.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.ddlAmphur.options[frmMain.ddlAmphur.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM amphur ORDER BY AMPHUR_ID ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = <?=$objResult["PROVINCE_ID"];?>;
strValue = "<?=$objResult["AMPHUR_ID"];?>";
strItem = "<?=$objResult["AMPHUR_NAME"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.ddlAmphur.options[frmMain.ddlAmphur.length]= myOption
}
<?
}
?>
}
//**** List Amphur (End) ***//
</script>
</head>
<form name="frmMain" action="show.php" method="post">
Geography
<select id="ddlGeo" name="ddlGeo" onChange = "ListProvince(this.value)">
<option selected value=""></option>
<?
$strSQL = "SELECT * FROM geography ORDER BY GEO_ID ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResult["GEO_ID"];?>"><?=$objResult["GEO_NAME"];?></option>
<?
}
?>
</select>
Province
<select id="ddlProvince" name="ddlProvince" style="width:120px" onChange = "ListAmphur(this.value)"></select>
Amphur
<select id="ddlAmphur" name="ddlAmphur" style="width:200px"></select>
</form>
</body>
</html>
<?
echo"<input type ='submit' value='บันทึก' title='บันทึก'> <Input type=\"reset\" value=\"ยกเลิก\">";
mysql_close($objConnect);
?>
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2010-05-31 15:11:02 |
By :
danupan |
View :
950 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
echo"<input type ='submit' value='บันทึก' title='บันทึก'> <Input type=\"reset\" value=\"ยกเลิก\">";
ต้องอยู่ใน Form นะครับ
|
 |
 |
 |
 |
Date :
2010-05-31 15:27:36 |
By :
onedan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอา echo"<input type ='submit' value='บันทึก' title='บันทึก'> <Input type=\"reset\" value=\"ยกเลิก\">"; ไว้ใน form นะ
<select id="ddlAmphur" name="ddlAmphur" style="width:200px"></select>
<? echo"<input type ='submit' value='บันทึก' title='บันทึก'> <Input type=\"reset\" value=\"ยกเลิก\">"; ?>
</form>
|
 |
 |
 |
 |
Date :
2010-05-31 15:29:05 |
By :
heng |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ได้แล้วครับขอบคุณมากครับ
ขอบถามต่อหน่อยครับจากฟอร์มนี้ คำสั่งที่เป็น list menu มันส่งค่ามาเป็น ID หมดเลยครับ
คือผมต้องการให้มันส่งค่ามาเป็นชื่อแทนครับ


ตรงกรอบสีแดง นี้ผมต้องการให้มันส่งค่ามาเป็นชื่อตามที่เราได้เลือกไว้ แต่มันกลับส่งมาเป็น Id ครับ
ผมต้องไปแก้ที่ตรงใหนครับ
<?
session_start();
include("connect_db.php");
include("permission_denied.php");
include("connect_header_banner.php");
include("den.php");
//echo "user_level=".$login_name;
//echo "user_level=".$login_name;
//$ligin_name=$
?>
<script language = "JavaScript">
//**** List Province (Start) ***//
function ListProduct(SelectValue)
{
frmMain.ddlVersion.length = 0
frmMain.ddlDish.length = 0
//*** Insert null Default Value ***//
//var myOption = new Option('รุ่นสินค้า','')
var myOption = new Option('--VERSION--','')
frmMain.ddlVersion.options[frmMain.ddlVersion.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM version ORDER BY version_id ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = <?=$objResult["brand_id"];?>;
strValue = "<?=$objResult["version_id"];?>";
strItem = "<?=$objResult["version"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.ddlVersion.options[frmMain.ddlVersion.length]= myOption
}
<?
}
?>
}
//**** List Province (End) ***//
//**** List Amphur (Start) ***//
function Listdish(SelectValue)
{
frmMain.ddlDish.length = 0
//*** Insert null Default Value ***//
//var myOption = new Option('หน้าจาน','')
var myOption = new Option('--DISH--','')
frmMain.ddlDish.options[frmMain.ddlDish.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM dish ORDER BY dish_id ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup = <?=$objResult["version_id"];?>;
strValue = "<?=$objResult["dish_id"];?>";
strItem = "<?=$objResult["dish"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.ddlDish.options[frmMain.ddlDish.length]= myOption
}
<?
}
?>
}
//**** List Amphur (End) ***//
</script>
<TITLE>กรุณาเพิ่มข้อมูลการบริการ</TITLE>
<?
$date = date("d-m-Y");
$date =explode("-",$date);
$time=getdate();
$hour=$time["hours"];
$minute=$time["minutes"];
$second=$time["seconds"];
$ser_date =explode("-",$ser_date);
$table_name = "service"; //ชื่อตาราง
echo "<center><Table border=1 cellspacing=0 cellpading=0 width=600 class=normal>";
echo "<form name='frmMain' action='s2.php' method='post' onsubmit='return check(this)'>";
echo"<tr><td align = right width=100><font size=2 color=#FF00CC>รหัสลูกค้า=</font>[$cus_id] </td><td > <IMG SRC=ManIcon.png WIDTH=20 HEIGHT=25></td></tr>";
echo"<Tr><td align = right><font size=2 color=#FF00CC>รายชื่อลูกค้า </td><td>
<input type ='hidden' name='cus_id' size=5 maxlength=30 value = '$cus_id' readonly>
<input type ='hidden' name='ser_id' size=5 maxlength=30 value = '$ser_id' >
$cus_name $surename</td></tr>";
echo"<Tr><td align = right><font size=2 color=#FF00CC>วันที่ให้บริการ </td><td>
<input type ='hidden' name='ser_date' size=5 maxlength=30 value = '$ser_date' readonly>
$ser_date[2]-$ser_date[1]-$ser_date[0]</td></tr>";
echo"<tr><td></td><td> ";
//include("adproduct/connect_product.php");
?>
<!--start ในส่วนของ list box-->
<select id="ddlBrand" name="ddlBrand" onChange = "ListProduct(this.value)">
<option selected value="">--BRAND--</option>
<?
$strSQL = "SELECT * FROM brand ORDER BY brand_id ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
while($objResult = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResult["brand_id"];?>"><?=$objResult["brand"];?></option>
<?
}
?>
</select>
<!--<select id="ddlVersion" name="ddlVersion" style="width:120px" onChange = "Listdish(this.value)"></select> -->
<select id="ddlVersion" name="ddlVersion" onChange = "Listdish(this.value)"></select>
<select id="ddlDish" name="ddlDish"></select>
<!-- end list box -->
<?
echo"</td></tr>";
echo "<tr><td align = right><font size=2 color=#FF00CC>SN </td><td> <Input type=\"text\" name=\"sn\" Size=\"15\" value=\"$sn\"><font size=2 color=#FF00CC> SMC <Input type=\"text\" name=\"smc\" Size=\"15\" value=\"$smc\" onkeypress=\"key_onkeypress()\"></td></tr>";
echo "<tr><td align = right><font size=2 color=#FF00CC>ราคา </td><td> <Input type=\"text\" name=\"price\" Size=\"10\" value=\"$price\" onkeypress=\"key_onkeypress()\"> </td></tr>";
//echo " <input type ='hidden' name='no[$no]' disabled value='$no'</Td>";
// }//end While
echo"<tr><td colspan = '2' align = 'center'><br><input type ='submit' value='บันทึก' title='บันทึก'> <Input type=\"reset\" value=\"ยกเลิก\"></td></tr>";
echo "</table>";
echo"</form>";
?>
|
 |
 |
 |
 |
Date :
2010-06-01 09:50:03 |
By :
danupan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
กระทู้นานแล้ว ไม่ทราบว่าได้คำตอบหรือยังคะ ถ้ามีใครพอทำได้รบกวนช่วยตอบด้วย
รอฟังคำตอบเช่นเดียวกันคะ มือใหม่เช่นกันคะ
|
 |
 |
 |
 |
Date :
2010-11-01 23:10:20 |
By :
bun |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|