我有2个下拉列表,仓库和位置(在我的编码中称为子软件)。
仓库是父级,位置是子级。 我想要的是,例如,当用户点击仓库ddl时, 结果将显示:
当用户点击[新加坡]时, 位置将显示:
**如何让我的位置显示仓库结果?
function einv_generateWarehouseDropdown($warehouse,$field,$subwarehouse)
{
//connect to database
base_connectDatabase();
echo "<select id=\"".$field."\" name=\"".$field."\" style=\"width:300px\" onChange=\"getSubjDesc(this.value);showSubWarehouseDetails(this.value)\" onfocus=\"getSubjDesc(this.value);showSubWarehousehouseDetails(this.value)\">";
//if (isset($warehouse)) {
if (isset($warehouse) && ($warehouse != "")) {
$warehousename = einv_getWarehouseDetail($warehouse);
echo "<option value=\"". $warehouse ."\">". $warehousename['einv_wh_name'] ."</option>";
} else {
$warehouse = 0;
}
$getWarehouseSQL = base_executeSQL("SELECT * FROM einv_warehouse where einv_wh_id<>" . $warehouse . "
ORDER BY einv_wh_name");
while($warehousedata_row = base_fetch_array($getWarehouseSQL)){
if (base_num_rows($getWarehouseSQL)!= 0) {
echo "<option value=\"". $warehousedata_row['einv_wh_id'] ."\">". $warehousedata_row['einv_wh_name']."</option>";
}
}
echo "</select>";
$subwarehouse = "";
$getSubWarehouseSQL = base_executeSQL("SELECT * FROM einv_subwarehouse ORDER BY einv_whs_name");
while($subwarehousedata_row = base_fetch_array($getSubWarehouseSQL)){
if (base_num_rows($getSubWarehouseSQL)!= 0) {
$subwarehouse.="<input type=hidden name='lstsubj_DESC_".$subwarehousedata_row['einv_whs_wh_id']."[]' id='lstsubj_DESC_".$subwarehousedata_row['einv_whs_id']."' value='".$subwarehousedata_row['einv_whs_id']."|||".$subwarehousedata_row['einv_whs_name']."'>\n";
//$subwarehouse.="<input type=hidden name='lstcomp_DESC_".$subwarehousedata_row['einv_whs_wh_id']."[]' id='lstcomp_DESC_".$subwarehousedata_row['einv_whs_id']."' value='".$subwarehousedata_row['einv_whs_id']."'>\n";
}
}
echo $subwarehouse;
//close the database
base_closeDatabase();
}
function einv_generateSubWarehouseDropdown($subwarehouse,$field)
{
//connect to database
base_connectDatabase();
$subwarehouse = NULL;
echo "<select id=\"".$field."\" name=\"".$field."\" style=\"width:200px\">";
// onChange=\"getSubjDesc(this.value);showSubWarehouseDetails(this.value)\" onfocus=\"getSubjDesc(this.value);showSubWarehousehouseDetails(this.value)\">";
if (isset($subwarehouse))
{
$subwarehousename = einv_getSubWarehouseDetail($subwarehouse);
echo "<option value=\"". $subwarehouse ."\">". $subwarehousename['einv_whs_name'] ."</option>";
//$subwarehouse.="<input type=hidden name='lstsubj_DESC_".$subwarehouse."' id='lstsubj_DESC_".$subwarehouse."' value='".$subwarehousename['einv_whs_name']."'>\n";
//$subwarehouse.="<input type=hidden name='lstcomp_DESC_".$subwarehouse."' id='lstcomp_DESC_".$subwarehouse."' value='".$subwarehousename['einv_whs_id']."'>\n";
}elseif(!isset($subwarehouse))
{
$subwarehouse = 0;
}
echo "SELECT * FROM einv_subwarehouse where einv_whs_id<>" . $subwarehouse . "
ORDER BY einv_whs_name";
$getSubWarehouseSQL = base_executeSQL("SELECT * FROM einv_subwarehouse where einv_whs_id<>". $subwarehouse . "
ORDER BY einv_whs_name");
while($subwarehousedata_row = base_fetch_array($getSubWarehouseSQL))
if (base_num_rows($getSubWarehouseSQL)!= 0)
{
echo "<option value=\"". $subwarehousedata_row['einv_whs_id'] ."\">". $subwarehousedata_row['einv_whs_name']."</option>";
// $subwarehouse.="<input type=hidden name='lstsubj_DESC_".$subwarehousedata_row['einv_whs_id']."' id='lstsubj_DESC_".$subwarehousedata_row['einv_whs_id']."' value='".$subwarehousedata_row['einv_whs_name']."'>\n";
// $subwarehouse.="<input type=hidden name='lstcomp_DESC_".$subwarehousedata_row['einv_whs_id']."' id='lstcomp_DESC_".$subwarehousedata_row['einv_whs_id']."' value='".$subwarehousedata_row['einv_whs_id']."'>\n";
}
echo "</select>";
echo $subwarehouse;
//close the database
base_closeDatabase();
}
答案 0 :(得分:0)