So I'm trying to generate select values with a loop. The issue here is that I can't use an if statement. I could set pieces of string together with a number of if statements, but that seems like an odd solution.
<select name="test">
<option disabled selected> -- Select an industry -- </option>
<?php
$numberOfIndustries = count($industryOptions); //industryOptions is an array
for($i = 0; $i <= $numberOfIndustries; $i++) {
echo "<option" . if (isset($_POST['test']) == true && $_POST['test'] == $industryOptions[$i]) { . "selected='true'" . }; . "value=" . $industryOptions[$i] . ">" . $industryOptions[$i] . "</option>";
}
?>
</select>