 |
|
คือผมอยากจะส่งค่า id_showbrand ที่อยู่ในตาราง tb_showbrand ให้มันไปอยู่ที่ตาราง tb_product
ในช่อง ref_id_showbrand ได้ยังไงครับ พอจะมีวิธีการส่งไหมครับ
อันนี้โค้ด list menu ครับ
code
</script>
<script language = "JavaScript">
//**** List Province (Start) ***//
function ListTb_type(SelectValue)
{
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.tb_subtype.options[frmMain.tb_subtype.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM tb_subtype ORDER BY id_subtype ASC ";
$objQuery = mysql_db_query($dbname, $strSQL);
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup1 = <?=$objResult["ref_id_type"];?>;
strValue = "<?=$objResult["id_subtype"];?>";
strItem = "<?=$objResult["name_subtype"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup1;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.tb_subtype.options[frmMain.tb_subtype.length]= myOption
}
<?
}
?>
}
//**** List Province (End) ***//
//**** List Amphur (Start) ***//
function ListTb_subtype(SelectValue)
{
frmMain.tb_showbrand.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.tb_showbrand.options[frmMain.tb_showbrand.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM tb_showbrand LEFT JOIN tb_brand ON tb_showbrand.ref_id_brand = tb_brand.id_brand ORDER BY ref_id_brand ASC ";
$objQuery = mysql_db_query($dbname, $strSQL);
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup2 = <?=$objResult["ref_id_subtype"];?>;
strValue = "<?=$objResult["id_showbrand"];?>";
strItem = "<?=$objResult["name_brand"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup2;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.tb_showbrand.options[frmMain.tb_showbrand.length]= myOption
}
<?
}
?>
}
//**** List Amphur (End) ***//
</script>
<table width="671" border="0" align="center" cellpadding="2" cellspacing="2">
<form action="admin_product2.php" method="post" enctype="multipart/form-data" name="frmMain" id="frmMain" onSubmit="return checked()">
<tr>
<td height="39"> </td>
<td> </td>
</tr>
<tr>
<td width="294"><div align="right"><b>เลือกหมวดสินค้า: </b></div></td>
<td width="363"><select name="tb_type" style="width:150px" onchange = "ListTb_type(this.value)">
<option selected="selected" value=""></option>
<?
$strSQL = "SELECT * FROM tb_type ORDER BY id_type ASC ";
$objQuery = mysql_db_query($dbname, $strSQL);
while($objResult = mysql_fetch_array($objQuery)){
?>
<option value="<?=$objResult["id_type"];?>">
<?=$objResult["name_type"];?>
</option>
<?
}
?>
</select></td>
</tr>
<tr>
<td><div align="right"><b>เพิ่มประเภทสินค้า: </b></div></td>
<td><select name="tb_subtype" style="width:180px" onchange = "ListTb_subtype(this.value)">
</select></td>
</tr>
<tr>
<td><div align="right"><b>เลือกแบรนด์สินค้า: </b></div></td>
<td><select name="tb_showbrand" style="width:100px">
</select></td>
</tr>
<tr>
<td> </td>
<td><div align="center">
<input name="Input" type="submit" value="Submit" />
<input type="reset" name="Reset" value="Reset" />
</div></td>
</tr>
</form>
</table>
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2010-07-27 11:53:44 |
By :
teekaiman |
View :
936 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |