Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 基于dropbox中发布的数据选择语句_Php_Mysql_Model View Controller_Pdo - Fatal编程技术网

Php 基于dropbox中发布的数据选择语句

Php 基于dropbox中发布的数据选择语句,php,mysql,model-view-controller,pdo,Php,Mysql,Model View Controller,Pdo,我在一个小网站上工作,目前我正忙于一个小问题。 我用HTML创建并填充了一组下拉框,例如: <select name="heatingType" id="heatingType" required> <option value="" disabled selected>Select Your Option</option> <option value = "Gas">Gas</option>

我在一个小网站上工作,目前我正忙于一个小问题。 我用HTML创建并填充了一组下拉框,例如:

<select name="heatingType" id="heatingType" required>
          <option value="" disabled selected>Select Your Option</option>
          <option value = "Gas">Gas</option>
          <option value = "Electricity">Electricity</option>
          <option value = "Other">Other</option>          
    </select>
如果我回显任何varibales,则它将显示在该下拉列表中选择和发布的值

我的表格结构如下:

HeatingType     MeterType   Bedrooms    HouseType   HouseAge              Consumption
Gas             Standard    1 or 2     Flat          Less than 11 years     5430
Gas             Standard    1 or 2     Flat          More than 11 years     7270
例如,如果我选择了Gas,Standard,1或2,Flat,小于11,那么我应该返回5430

现在我面临的问题是如何在select语句中使用这些已发布的值, 我知道我需要做以下几点:

SELECT Consumption fron ConTable WHERE HeatingType LIKE heatingTypeDropdownValue AND MeterType LIKE MeterTypeDropDownValue etc etc.
但我不太确定 任何帮助都将不胜感激
谢谢

我通过创建会话数组解决了这个问题:

`$_SESSION['post-data'] = $_POST;
$_SESSION['post-data']['heatingType'];
$_SESSION['post-data']['meterType'];
$_SESSION['post-data']['noBedrooms'];
$_SESSION['post-data']['houseType'];
$_SESSION['post-data']['houseAge'];`
然后在where子句中使用
$\u SESSION['post-data']['heatingType']

`$_SESSION['post-data'] = $_POST;
$_SESSION['post-data']['heatingType'];
$_SESSION['post-data']['meterType'];
$_SESSION['post-data']['noBedrooms'];
$_SESSION['post-data']['houseType'];
$_SESSION['post-data']['houseAge'];`