0

SEEMS AS IF MY ARTICLE HAS BEEN SUBMITTED TWICE. I DO APOLOGISE FOR THAT

Hi guys,
I'm working on a small website and I'm currently stuck on a small issue.
Ive got a set of dropdown boxes created and populated in HTML, for example:

<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>

I'm able to store the values in a variable once the form has been posted/submitted, These are stored in my Controller Class eg:

    $newCalc = new ConCalc();
    // instantiate drawing tool
    $draw = new DrawTool();
    // parse (render) appliance view
    $renderedView = $draw->render('../View/calculator.php', array('calcvalues' => $newCalc->getValues()));

    if(isset($_POST['btn-calcCon'])){

            $heatType = $_POST['heatingType'];
            $meterType = $_POST['meterType'];
            $bedrooms = $_POST['noBedrooms'];
            $house = $_POST['houseType'];
            $age = $_POST['houseAge'];

                echo $heatType;
                echo $meterType;
                echo $bedrooms;
                echo $house;
                echo $age;

        }


    echo $renderedView;

If i echo out $heatType then it will display the value that was selected.

My table structure is as follows:

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

Now the problem I'm facing is how to use these posted values in a select statement,
for example

SELECT Consumption fron ConTable WHERE HeatingType = heatingTypeDropdownValue AND MeterType = MeterTypeDropDownValue etc etc.

I have tired it but kept getting quite a few errors.
Any help will be appreciated
Thanks!

Edited by spud91

2
Contributors
2
Replies
17
Views
1 Year
Discussion Span
Last Post by spud91
0

Hi i managed to semi fix it by creating a session array that holds all the posted data.
Now i just need to figure out how to print out the Consumption value thats returned based on the select statement

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.