If statement on $_REQUEST then do something.

2 posts by 2 authors in: Forums > CMS Builder
Last Post: January 17, 2020   (RSS)

By Zicky - January 16, 2020

Howdy folks,

I'm trying to create in if statement that will only display the last select option "All Floor Plans" if a prior selection exist, but I can't seem to get this figured out. Any suggestions on how to get this if statement to function are much appreciated. 

<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" id="floorplanResults">
    <select name="floor_plan_match" onchange="$('#floorplanResults').submit();">
        <option value="">Floor Plans</option>
    <?php foreach ($homes_for_saleCatArray as $value => $label): ?>
        <option value="<?php echo $value; ?>" <?php selectedIf($value, @$_REQUEST['floor_plan']) ?>><?php echo $label; ?></option>
    <?php endforeach ?>
        <?php if($_REQUEST['floor_plan'] === $value): ?><option value="">All Floor Plans</option><?php endif; ?>
    </select>
  </form>

Thanks, Zick