I am pulling form data from `home.php` into `results.php` and using `$_GET['xxxxx']` to pre-populate fields of another form. I can populate `input` fields okay, but how would you compare an `option` field and `$sale_type` to selected if equal?

**home.php**

```
<form action="results.php" method="GET">

    <input id="address" name="address" type="text" class="form-control1"/>

    <select type="text" name="sale_type" placeholder="Sale Type">
        <option value="Sale">For Sale</option>
        <option value="Rent">To Rent</option>
    </select>

   <input name="submit" type="SUBMIT" value="Next" class="form-control1">

</form>

```

**results.php**

Option fields are already populated to ensure the form will work if it's used without results from `home.php`. I need to compare `$sale_type` value with the option of `name="sale_type` and if equal change that option value to selected.

```
    $address = $_GET['address'];
    $sale_type = $_GET['sale_type']; ?>

    <form method="POST">

        <input id="address" name="address" type="text" value='<?php echo $address; ?>'>

        <select type="text" name="sale_type" placeholder="Sale Type">
            <option value="Sale">For Sale</option>
            <option value="Rent">To Rent</option>
        </select>

        <button type="submit" id="filter">Search</button>
        <input type="hidden" name="action" value="ek_search">

    </form>

```

**What I'd like results to do**

```
    $address = $_GET['address'];
    $sale_type = $_GET['sale_type']; ?> //If value is Sale

    <form method="POST">

        <input id="address" name="address" type="text" value='<?php echo $address; ?>'>

        <select type="text" name="sale_type" placeholder="Sale Type">
            <option value="Sale" selected>For Sale</option> //Change to selected if equal
            <option value="Rent">To Rent</option>
        </select>

        <button type="submit" id="filter">Search</button>
        <input type="hidden" name="action" value="ek_search">

    </form>

```