I want to use selected option with condition. if $type is room then bed will be selected and if it is bathroom then toilet will be selected. what is wrong with this code. how to correct it????
<html>
  <body>
    <?php
      $type="bathroom";
    ?>
    <form method="post" action="<?php $_PHP_SELF ?>">
      <select name="bedtype">
      <% if($type=="bathroom"){ %>
       <option value="room">BED</option>
       <option value="bathroom" selected>TOILET</option>
      <% } else { %>
       <option value="room" selected>BED</option>
       <option value="bathroom" >TOILET</option>
      <% } %>
      </select>
    </form>
  </body>
</html>
 
     
     
    