SELECTED = SELECTED&Chain选择PHP

I have a Chain SELECT which is working great, but I want to be able to push data from a search records form on to this form which includes a Chain SELECT, how is it possible for me to use SELECTED = SELECTED within this code?

my select.class.php

<?php
class SelectList {
    public function ShowMake($searchboilermake) {
        include "./core/cnn.php";
        $sql = "SELECT * FROM blr_boilermake";
        $res = mysql_query($sql);
        $boilermake = '<option value=""></option>';
        while($row = mysql_fetch_array($res)) {
            $boilermake .= '<option value="' . $row['BoilerID'] . '"';
            $boilermake .= ($row['BoilerID']==$searchboilermake) ? " selected='selected' " : "";
            $boilermake .= '>' . $row['BoilerMake'] . '</option>';
        }
        return $boilermake;
    }

    public function ShowModel() {
        include "../core/cnn.php";
        $sql = "SELECT * FROM blr_boilermodel WHERE BoilerModel IS NOT NULL AND BoilerID = $_POST[id]";
        $res = mysql_query($sql);
        $boilermodel = '<option value="0"></option>';
        while($row = mysql_fetch_array($res)) {
            $boilermodel .= '<option value="' . $row['ModelID'] . '">' . $row['BoilerModel'] . '</option>';
        }
        return $boilermodel;
    }
}
$opt = new SelectList();
?>

from my form on my page I use this to pull in the select.class.php for the boilermake field

<label>Manufacturer</label>
<select class="select2_category form-control" data-placeholder="Choose a Category" tabindex="1" id="boilermanufacturer" name="boilermanufacturer">
<?php echo $opt->ShowMake($_REQUEST['boilermanufacturer']); ?>
</select>

and this for my boilermodel field

<label>Model</label>
<select class="select2_category form-control" data-placeholder="Choose a Category" tabindex="1" id="boilermodel" name="boilermodel">
 <option value=""></option>
</select>

Within other SELECTS that are much more straight forward and standard SELECT I use this below, but how can I adapt this below to my Chain SELECT?

<div class="form-group">
<label>Fuel Type</label>
<?php $fueltype = db::getInstance()->query('SELECT * FROM lkup_fueltype');
if(!$fueltype->count()) { 
    echo 'Problem'; 
} else { ?> 
<select class="select2_category form-control" data-placeholder="Choose a Category" tabindex="1" id="propertyfueltype" name="propertyfueltype">
<?php foreach ($fueltype->results() as $fueltype) { ?>
<option value="<?php echo $fueltype->ID; ?>"<?php echo $fueltype->ID == $searchboilerfueltype ? "selected" : ""; ?>><?php echo $fueltype->PropertyFuelType; ?></option> <?php } } ?>
</select>

I tried to use this, but it didn't select the SELECTED row when I ran the code

$boilermake .= '<option value="' . $row['BoilerID'] . '" "' . $row['BoilerID'] . '" == $searchboilermake ? "selected" : "">' . $row['BoilerMake'] . '</option>';

What should I have done/or what can I do to get this to work?

The problem is you tried to use a boolean/ternary expression inside a string. That obviously will not evaluate in a string like that.

$boilermake .= '<option value="' . $row['BoilerID'] . '"';
$boilermake .= ($row['BoilerID']==$searchboilermake) ? " selected='selected' " : "";
$boilermake .= '>' . $row['BoilerMake'] . '</option>';

Edit: You need to fix the function ShowMake to pass in $searchboilermake as a parameter.

Definition of function:

public function ShowMake($searchboilermake) {

Call to function:

<?php echo $opt->ShowMake($_REQUEST['boilermanufacturer']); ?>