2
我正在构建一个网页,使用户能够查看他们选择的特定产品的报告。步骤如下:使PHP函数互相协作
User chooses interface
(Beta或Cloud) - >User Chooses Product
(产品基于所选接口) - > Info会相应显示。
其中显示的信息写入如下页面:
HTML
<div class="roundiv" >
<h4>*Interface: </h4>
<select class="form-control " style='width:250px;' onclick="INSERT SOMETHING HERE" >
<option value="-1" >Select Interface </option>
<?php
config::selectInterface($cao);
?>
</select>
<h4>
*Product:
</h4>
<select class="form-control" style="width:250px;">
<option value="-1" >Select Product</option>
<?php
config::selectIntProduct($cao);
?>
</select>
<button class="btn btn-success " value="Submit" onclick="" style="margin-left: auto; display:block;" > Submit </button>
<!-------------INFO WILL BE DISPLAYED HERE------------->
</div>
我已经开始在配置类编写功能,并希望保持这种方法。
这是我的配置类编写的函数:
功能1
public static function selectInterface(CGenDb $cao) {
$sel_interface_options = new CGenRS("select type_desc, type_id from lu_type where type_status = 't' and type_group = 'cloud' and type_sub_group = 'db'", $cao);
$sel_interface_options->first();
if ($sel_interface_options->rowcount()) {
while (!$sel_interface_options->eof()) {
echo "<option value='" . $sel_interface_options->valueof('type_id') . "'>" . $sel_interface_options->valueof('type_desc') . "</option>";
$sel_interface_options->next();
}
}
$interface_bool = True;
return $interface_bool;
}
和类selectIntProducts
会是这个样子:
功能2
public static function selectIntProduct(CGendb $cao,$selected_interface){
$selected_interface=$cao_interface= "The interface ID"
$sel_product_options = new CGenRS("select prod_name, prod_id from lu_products where prod_active = 't'", $cao_interface);
$sel_product_options->first();
if ($sel_product_options->rowcount()) {
while (!$sel_product_options->eof()) {
echo "<option value='" . $sel_product_options->valueof('prod_id') . "'>" . $sel_product_options->valueof('prod_name') . "</option>";
$sel_product_options->next();
}
}
}
这是我需要帮助的:
我想要显示的产品选择器只有一个接口/选择。(我的想法是从功能1返回
$interface_bool
,测试,如果这是真的,如果是,显示下一个部分。 )在功能选择的值1应该然后在功能2
的$selected_interface
我怎样才能做到这一点?